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 | |
$patterns = []; | |
$data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data'), true); | |
$countries = explode('~', $data['countries']); | |
foreach ($countries as $country) { | |
$data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data/'.$country), true); | |
if (isset($data['zip'])) { | |
$patterns[$country] = $data['zip']; | |
} |
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
var detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |
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
# Adds basic, but really fast autocompletion for gulp. | |
# | |
# NOTE! | |
# Only the tasknames will be autocompleted. | |
# | |
# Why? | |
# ---- | |
# Default gulp completion is really-really slow, hard to work with. | |
# However this solution is quite dump, it covers 90% of my workflow. | |
# |
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
KEY=XXXXXXXXXXXX | |
HOST="https://metrics.crisidev.org" | |
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do | |
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json | |
done |
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
// locate the storage class in your application | |
const storage = require('../path-to/storage'); | |
module.exports = async (body, key) => { | |
try { | |
//using that class to put object in s3 | |
await storage.put( | |
process.env.ASSETS_BUCKET, | |
key, | |
body, |
OlderNewer