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 | |
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" | |
brew doctor | |
sudo gem update --system | |
gem install compass | |
brew install phantomjs | |
brew install jpeg-turbo && brew link jpeg-turbo | |
brew install optipng | |
sudo npm install -g yeoman |
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 sudokuGenerator() { | |
'use strict'; | |
var test4 = [ | |
1, 2, 3, 4, | |
3, 4, 1, 2, | |
2, 3, 4, 1, | |
4, 1, 2, 3 | |
]; |
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 getVisibleWidth(elem) { | |
// cross browser, returns decimals for ultra-precision | |
return elem.getBoundingClientRect().right - elem.getBoundingClientRect().left; | |
} | |
function getNaturalWidth(elem) { | |
var old = { | |
overflow: elem.style.overflow, | |
width: elem.style.width, | |
display: elem.style.display |
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 _ = require('underscore') | |
function sayHello() { | |
console.log('Hello, World'); | |
} | |
_.times(5, sayHello); | |
*/ | |
var image = [ | |
[1, 1, 1, 1, 1, 1, 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
function track() { | |
var scrollCount = 0; | |
var fetching = false; | |
return function () { | |
if($(window).height() + $(window).scrollTop() >= $('.content').offset().top + $('.content').outerHeight() && !fetching) { | |
scrollCount += 100; | |
fetching = true; | |
$.ajax('http://sfbay.craigslist.org/search/bka' + ( scrollCount > 0 ? '?s='+scrollCount : '' )).then(function(x) { |
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 guessDownloadDuration($cbz, MBps) { | |
if ($cbz.length === 0) { | |
return 0; | |
} | |
const rawValue = $cbz.parent().find('.right-align').contents().get(0).textContent; | |
if (rawValue.includes('MB')) { | |
const sizeInMb = parseFloat(rawValue.split('MB')[0].trim()); | |
const durationInMs = Math.round(sizeInMb / MBps * 1000); |
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 $ */ | |
function getInputs() { | |
return $('#stations-list li').map(function() { | |
return { | |
symbol: $(this).data('skey'), | |
name: $(this).text() | |
}; | |
}).toArray(); | |
} |
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 | |
# Emoji / logging nonsense | |
SPACE=$'\xe2\x80\x83' | |
ERROR=$'\xF0\x9F\x94\xB4'$SPACE | |
INFO=$'\xF0\x9F\x94\xB5'$SPACE | |
OK=$'\xE2\x9C\x85'$SPACE | |
error() { echo "$ERROR $1"; } | |
warn() { echo "$INFO $1"; } | |
ok() { echo "$OK $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
#!/bin/bash | |
function testRecurse { | |
ONE=${1:0} | |
TWO=("${@:1}") | |
if [[ $# -eq 1 ]]; then | |
echo Final answer $ONE | |
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
#!/bin/bash | |
START_TIME=1420099200000 # Unix timestamp | |
END_TIME=1592164819833 # Unix timestamp | |
INDEX=0 | |
PREFIX='drives' # name is up to you | |
BEARER_TOKEN="<fill-this-with-your-token>" | |
URL="https://api.automatic.com/trip/?started_at__gte=${START_TIME}&started_at__lte=${END_TIME}&limit=250" # limit cannot be > 250 I think | |
set_current_file () { | |
CURRENT="${PREFIX}_${INDEX}.json" |
OlderNewer