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
data = """ | |
Make, Model | |
Jag, X-type | |
Merc, CL | |
""" | |
csv = d3.csv.parse(data) | |
columns = Object.keys(csv[0]) | |
# Create the actual body of the table |
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
#!/usr/bin/env escript | |
main(_) -> | |
List = [1,2,3,4,5,6,7,8,9], | |
NewList = reverse(List), | |
io:format(NewList), | |
shifter("This should not pass correctly"), | |
%% list comprehension, because they are cool in Erlang | |
Comprehended = [ N bsl 4 || N <- List, 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
gem install html2haml && gem install haml2slim | |
# then... convert and remove original erb files: | |
find ./app/views -name '*.erb' | xargs -I file sh -c \ | |
'html2haml --erb file | haml2slim > $(echo file | sed 's/erb/slim/') && \ | |
rm file' |
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
# rename all scss files... | |
find *.scss | xargs -I file sh -c 'mv file $(basename file | sed 's/scss/sass/')' |
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
/* Pulling out vocab from Duolingo's Words page */ | |
var raw, | |
cleaned, | |
filtered, | |
xhr = new XMLHttpRequest; | |
var parser = function(data) { | |
raw = JSON.parse(data); | |
cleaned = raw.vocab_overview.filter(function(word) { |
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
SELECT users.username, | |
((CASE WHEN quizzes.quiz_type = 1 THEN 'M' ELSE 'B' END) || | |
(CASE WHEN user_answers.practical_id IS NULL THEN '' ELSE 'P' END) || | |
quizzes.challenge_number || 'Q' || questions.question_number) | |
AS quest, | |
SUM(result) As score | |
FROM "user_answers" | |
INNER JOIN "users" ON "users"."id" = "user_answers"."user_id" |
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
package main | |
import ( | |
"encoding/base64" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"mime" | |
"path/filepath" | |
"strings" |
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
/* | |
6371 for Kms | |
3956 for Miles | |
$lat, $lng are passed in | |
*/ | |
SELECT *, | |
( 3956 * acos( cos(radians($lat)) * cos(radians( lat.field_latitude_value )) * | |
cos(radians( lng.field_longitude_value ) - radians($lng)) + sin(radians($lat)) | |
* sin(radians( lat.field_latitude_value )) ) ) |
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
alias dc="docker" | |
alias dr="dc run" | |
alias ds="dc stop" | |
alias di="dc images" | |
alias drmi="dc rmi" | |
alias drm="dc rm" | |
alias dip="dc inspect -f '{{ .NetworkSettings.IPAddress }}'" |
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
# | |
# Read a series of XML documents into a large Array of Hashes | |
# export as JSON | |
# | |
# assign some constants to handle file names / paths | |
PATH_TO_XML_FILES, EXPORT_FILE = ARGV.first, ARGV.last | |
# argument validation | |
raise ArgumentError, 'You must specify a path from which to read the XML documents' if PATH_TO_XML_FILES.nil? |
OlderNewer