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 JsonToCsv(json) { | |
var csv = ''; | |
// Begin with the header row, using | |
// the keys as headings. | |
for (var key in json[0]) { | |
csv += key + ','; | |
} |
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
#global-loading { | |
background: lighten(#ff0, 35%); | |
@include borderBottomRadius(3px); | |
@include boxShadow((0 0 5px rgba(#000, .5))); | |
color: #333; | |
color: rgba(#000, .4); | |
font-size: 24px; | |
font-weight: bold; | |
left: 50%; | |
height: 70px; |
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
require 'sinatra' | |
set :port, 4567 | |
set :public_folder, File.dirname(__FILE__) + '/' | |
get '/' do | |
File.read('index.html') | |
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
@keyframes pendulum { | |
0%, 100% { transform: rotate(-5deg); } | |
10%, 90% { transform: rotate(0deg); } | |
40%, 60% { transform: rotate(90deg) } | |
50% { transform: rotate(95deg); } | |
} |
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
// Rest of code omitted. | |
.directive('myDirective', function () { | |
return { | |
restrict : 'E', | |
templateUrl : '/templates/directives/mydirective.html', | |
replace : true | |
} | |
}) | |
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
require 'sinatra' | |
require 'launchy' | |
set :port, 7428 | |
post '/webpage' do | |
begin | |
Launchy.open(params[:url]) | |
rescue | |
print 'Failed :(' |
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
/* | |
Call start() on console to run program. | |
May be a little rough around the edges, I'm trying to remember the | |
jQuery API from memory as my home internet's too slow to Google stuff. | |
Oh and it requires jQuery, because everything requires jQuery! | |
*/ | |
function start() { |
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 pascal(rows) { | |
var pascalsTriangle = []; | |
for (var row=1; row<=rows; row++) { | |
var rowResults = []; | |
if (pascalsTriangle[row-2]) { | |
var aboveRow = pascalsTriangle[row-2]; |
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
expect(function() { | |
// Call the code here. | |
}).toThrow(new Error('some error')); |
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 deepOmit = function(input, propertyToRemove) { | |
var output = input; | |
if (_.isArray(input)) { | |
output = []; | |
_.each(input, function(arrayItem) { | |
output.push(deepOmit(arrayItem, propertyToRemove)); | |
}); | |
} | |
else if (_.isObject(input)) { | |
output = {}; |