Skip to content

Instantly share code, notes, and snippets.

View sinyo1015's full-sized avatar
😳
(=◉ᆽ◉=) Hemllo There

Sinyo sinyo1015

😳
(=◉ᆽ◉=) Hemllo There
View GitHub Profile
@fgilio
fgilio / axios-catch-error.js
Last active February 27, 2025 05:50
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@cahsowan
cahsowan / terbilang.php
Created April 21, 2015 04:16
Fungsi Terbilang Dengan PHP
<?php
function terbilang($x) {
$angka = ["", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"];
if ($x < 12)
return " " . $angka[$x];
elseif ($x < 20)
return terbilang($x - 10) . " belas";
elseif ($x < 100)
@chrisjhoughton
chrisjhoughton / crop-resize.js
Last active January 9, 2021 05:19
Given an image URL or path, crop and resize it to be exactly a specific size. Crops centrally to force enforce the correct aspect ratio, and then resizes as per normal. Depends on the `when` and `gm` NPM modules. Returns a promise that resolves with an image buffer in a .PNG format.
/*
* Given an image URL or path, crop and resize it to be exactly a specific size.
* Crops centrally to force enforce the correct aspect ratio, and then resizes as per normal.
* Depends on the `when` and `gm` NPM modules.
* Returns a promise that resolves with an image buffer in a .PNG format.
*/
var when = require('when');
var gm = require('gm');
var im = gm.subClass({ imageMagick: true }); // use `im` in place of `gm` for heroku compatibility
@RoesWibowo
RoesWibowo / validation.php
Last active November 11, 2020 16:06
Laravel 4 Validation Message Bahasa Indonesia
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
@decause
decause / mei_me hack
Created September 18, 2013 17:14
This is a hack to fix the horrible bug that is https://bugzilla.redhat.com/show_bug.cgi?id=917081 Shoutout @lmacken, who is the progenitor of this gist :)
echo "blacklist mei_me" > /etc/modprobe.d/blacklist-mei.conf
echo "blacklist mei" >> /etc/modprobe.d/blacklist-mei.conf
cp /etc/default/grub /etc/default/grub.bak
sed -i 's/quiet/rdblacklist=mei rdblacklist=mei_me quiet/'
/etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
# then if you don't want to reboot
rmmod mei_me
rmmod mei
@faisalman
faisalman / Rupiah.as
Created February 26, 2011 15:35
Konversi Angka ke format Rupiah & vice versa (C#, PHP, JavaScript, ActionScript 3.0)
package
{
/**
* ActionScript 3.0 Code Snippet
* Convert Number to Rupiah & vice versa
* https://gist.github.com/845309
*
* Copyright 2011-2012, Faisalman
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license