This file contains hidden or 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" |
This file contains hidden or 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
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
char rotors[3][27] = | |
{ | |
"EKMFLGDQVZNTOWYHXUSPAIBRCJ", | |
"AJDKSIRUXBLHWTMCQGZNPYFVOE", | |
"BDFHJLCPRTXVZNYEIWGAKMUSQO" |
This file contains hidden or 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
gem 'angularjs-rails' | |
gem 'chart-js-rails' |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |