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
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
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 | |
/** | |
* $files_array contains $_FILE superglobal | |
* | |
* Helps with Unit Testing | |
* | |
* @var array | |
*/ | |
protected $file_array = array(); |
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
/* | |
Most map tile providers use 256px square tiles so Leaflet's basic zoom algorithm looks like this: | |
256 * Math.pow(2, zoom); | |
If you're working with vector layers you can extend one of leaflet's default CRSs | |
and make it return tile sizes in smaller increments. This can be very helpful when using | |
fitBounds() with layer groups, so the zoomed group fits better within the map bounds: | |
E.g., extending L.CRS.EPSG3857 (the default CRS): |
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
if (window.File && window.FileReader && window.FileList && window.Blob) { | |
// Great success! | |
function handleJSONDrop(evt) { | |
evt.stopPropagation(); | |
evt.preventDefault(); | |
var files = evt.dataTransfer.files; | |
// Loop through the FileList and read | |
for (var i = 0, f; f = files[i]; i++) { | |
// Only process json files. |
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
/** | |
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded | |
* templates and such with AngularJS. Use this simple directive to | |
* tame this beast once and for all. | |
* | |
* Usage: | |
* <input type="text" autofocus> | |
* | |
* License: MIT | |
*/ |
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
function check(resolved) { | |
console.log(resolved); | |
var tag = resolved.split('/').pop(-1); | |
var latest = tag.slice(1); | |
var current = atom.getVersion(); | |
if (latest != current) { | |
atom.notifications.addInfo('new version available: ' + resolved); | |
// TODO detect platform | |
// var filename = 'atom-amd64.deb'; // or 'atom.x86_64.rpm' | |
// var url = 'https://github.com/atom/atom/releases/download/' + tag + '/' + filename; |
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
#!/bin/sh | |
# Use git to push to deploy (aka git push to prod) | |
# Use 'git push remote master' to push to deploy | |
# This script only deploys on pushes to master. | |
# | |
# HOWTO: | |
# On your server to deploy, create a bare git directory | |
# (somewhere like /var/git/<gitProject>) | |
# Your depoly directory (like /var/www) should be somewhere other than your git repo. |
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
[ | |
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} }, | |
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} }, | |
{ "keys": ["alt+shift+o"], "command": "run_macro_file", "args": {"file": "Packages/User/output.sublime-macro"} }, | |
{ "keys": ["alt+shift+c"], "command": "run_macro_file", "args": {"file": "Packages/User/console.sublime-macro"} }, | |
{ "keys": ["ctrl+shift+t"], "command": "open_recent_file", "args": {"index": 0 } } | |
] |
OlderNewer