This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 😨 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
/* | |
|-------------------------------------------------------------------------- | |
| Validation Language Lines | |
|-------------------------------------------------------------------------- | |
| | |
| The following language lines contain the default error messages used by |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |