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
server { | |
listen 80; | |
server_name localhost.my_node_app | |
alias 10.72.12.91; #Rewrite all incoming requests to this app - for debugging on mobile devices etc where we cannot add to the hosts file. | |
access_log /var/log/nginx/my_node_app.log; | |
location / { | |
#Set correct headers | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
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
info: jitsu v0.10.2, node v0.8.5 | |
info: It worked if it ends with Nodejitsu ok | |
info: Executing command deploy | |
info: Analyzing application dependencies in node app.js | |
warn: Local package version appears to be old | |
warn: The package.json version will be incremented automatically | |
warn: About to write /private/var/www/blog/package.json | |
warn: Using '*' as a version for dependencies may eventually cause issues | |
warn: Use specific versions for dependencies to avoid future problems | |
warn: See: http://package.json.jit.su for more information |
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
doc = Nokogiri::HTML(open("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml")) | |
doc.remove_namespaces! | |
doc.xpath("//Cube/Cube/Cube").each do |node| | |
puts node.attr("rate") | |
end |
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
$v = "Muse - Supermassive Black Hole[Dubstep Version][muse.mp3]"; | |
//Match ending [], that contains .mp3 | |
preg_match("/\[([^]]*.mp3+)\]$/i", $v, $match); | |
//Remove [] from matched string | |
$track_url = preg_replace('/[[\]]/', '', $match[0]); | |
//Remove mp3 link from title | |
$track_title = preg_replace("/\[([^]]*.mp3+)\]$/i", '', $v); |
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
populateEmptyArrays = function(vars, num) { | |
//Function to pre-populate multiple 2D arrays | |
//vars = Array of variable names to pre-populate with arrays | |
//num = Array size | |
if(!(vars instanceof Array) || isNaN(num)) return; | |
for(i in vars) { | |
window[vars[i]] = (function(a){ while(a.push([]) < num); return a})([]) | |
} | |
} |
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
// http://jsperf.com/javascript-find-all | |
function indexes(str, find) { | |
var result = []; | |
for(i=0;i<str.length; ++i) { | |
if (str.substring(i, i + find.length) == find) { | |
result.push(i); | |
} | |
} | |
return result; |
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 matches(str, find) { | |
var regex = new RegExp(find,"gi"); | |
return str.match(regex).length; | |
} | |
console.log(matches("I learned to play the Ukulele in Lebanon.", "le")); |
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
letterSwap = function(str, swap) { | |
ot = str.split(''); | |
for( i in str) { | |
if(i%swap===0) { | |
ot[i] = str[parseInt(i)+swap-1]; | |
ot[parseInt(i)+swap-1] = str[i]; | |
} | |
} | |
return ot.join(''); | |
} |
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
#import "Bikes.h" | |
static sqlite3 *database = nil; | |
static sqlite3_stmt *detailStmt = nil; | |
@implementation Bikes | |
@synthesize BikesID, BikesName, price, isDirty, modelCount; | |
@synthesize modelName,modelID,modelType,groupCount,modelBrand; | |
@synthesize year,category,displacement,power,topSpeed,fuelConsumption,powerWeightRatio,naughtSixty,torque; |
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
;'use strict'; | |
enigma = (function() { | |
var _rotors = [ 'EKMFLGDQVZNTOWYHXUSPAIBRCJ', | |
'AJDKSIRUXBLHWTMCQGZNPYFVOE', | |
'BDFHJLCPRTXVZNYEIWGAKMUSQO' | |
] | |
, _reflector = "YRUHQSLDPXNGOKMIEBFZCWVJAT" | |
, _alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |