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 | |
redis_version=2.6.7 | |
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
############################################### | |
# To use: | |
# wget https://gist.github.com/raw/4497007/866287a130a5a4ca12a132fd52e391cde39f4f3f/install-redis.sh | |
# chmod +x install-redis.sh | |
# ./install-redis.sh |
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 | |
// http://www.leofs.org/docs/s3_client.html | |
// i used composer with the following composer.json file and then called composer install | |
// {"require":{"aws/aws-sdk-php": "2.*"}} | |
require "vendor/autoload.php"; | |
use Aws\Common\Enum\Region; | |
use Aws\S3\S3Client; |
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
// ==== DOING CLASSES IN JS ============================================/ | |
// constructor function | |
function MyClass () { | |
var privateVariable; // private member only available within the constructor fn | |
this.privilegedMethod = function () { // it can access private members | |
//.. | |
}; | |
} |
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 | |
$array = csv_to_array(file_get_contents('some_file.csv')); | |
$json = json_encode($array); | |
echo $json; | |
/** | |
* This awesome function will return an | |
* array of rows with the key values of | |
* each row matching the column header |
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 csvToJson(str) { | |
var data = [], i = 0, k = 0, header = []; | |
var csvLines = CSVToArray(str); | |
for ( i = 0; i < csvLines.length; i++ ) { | |
var line = csvLines[i]; | |
if ( i == 0 ) { | |
header = csvLines[i]; | |
} else { |
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
# create a repo | |
# 1. In your user bar at the top right of any page, click the "Create a New Repo" button | |
# 2. Dashboard context switcherSelect the account you wish to create the repository on | |
# 3. Create repository fieldEnter a name, select to make the repository either public or private and click "Create repository" | |
git clone https://github.com/mlconnor/[new-project-name] | |
# add your files | |
git add index.js | |
# commit that stuff back to github |
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
/** | |
* Returns true or false | |
* indicating whether or not the URL | |
* passes a TLD check. | |
*/ | |
function check_tld($url) { | |
$parsed_url = parse_url($url); | |
if ( $parsed_url === FALSE ) return false; | |
return preg_match('/\.(aero|asia|biz|cat|com|coop|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|mlcee|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bl|bm|bn|bo|bq|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mf|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug| |
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 regex = /^(?:\d{4})(?:(?:(09|04|06|11)(?:01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30))|(?:(?:01|03|05|07|08|10|12)(?:01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31))|(?:02(?:01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)))$/; | |
var m30 = "(?:(?:09|04|06|11)(?:0[1-9]|1[0-9]|2[0-9]|30))"; | |
var m31 = "(?:(?:01|03|05|07|08|10|12)(?:0[1-9]|1[0-9]|2[0-9]|3[01]))"; | |
var fLeap = "(?:02(?:0[1-9]|1[0-9]|2[0-9]))"; | |
var fNonLeap = "(?:02(?:[01][0-9]|2[0-8]))"; | |
var nonLeapMonths = "(?:" + m30 + "|" + m31 + "|" + fNonLeap + ")"; | |
var leapMonths = "(?:" + m30 + "|" + m31 + "|" + fLeap + ")"; |
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
[{"regex": ["http://*youtube.com/watch*", "http://*.youtube.com/v/*", "https://*youtube.com/watch*", "https://*.youtube.com/v/*", "http://youtu.be/*", "http://*.youtube.com/user/*", "http://*.youtube.com/*#*/*", "http://m.youtube.com/watch*", "http://m.youtube.com/index*", "http://*.youtube.com/profile*", "http://*.youtube.com/view_play_list*", "http://*.youtube.com/playlist*"], "about": "YouTube is the world's most popular online video community, allowing millions of people to discover, watch and share originally-created videos. YouTube provides a forum for people to connect, inform, and inspire others across the globe and acts as a distribution platform for original content creators and advertisers large and small.", "displayname": "YouTube", "name": "youtube", "domain": "youtube.com", "subdomains": ["m.youtube.com"], "favicon": "http://c2548752.cdn.cloudfiles.rackspacecloud.com/youtube.ico", "type": "video"}, {"regex": ["http://*twitch.tv/*", "http://*justin.tv/*/b/*", "http://*justin.tv/*/w/*"], "about": |
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 Parser = require("jison").Parser; | |
var grammar = { | |
"lex": { | |
"rules": [ | |
["\\s+", "/* skip whitespace */"], | |
[",", "return ','"], | |
["<", "return '<'"], | |
[">", "return '>'"], |