Skip to content

Instantly share code, notes, and snippets.

View ef2k's full-sized avatar
💭
recalibrating

Eddie Flores ef2k

💭
recalibrating
View GitHub Profile

For Nick

Sample Data

I tried to copy your data model as I understood it. I created two User nodes each with five View nodes. User 1’s sequence of views touches a distinct set of Page nodes; User 2’s sequence of views is not a distinct set; User 2 visits the analytics page twice.

@ef2k
ef2k / stress.sh
Created September 24, 2014 15:16
Stress Test Script for Golang
#!/usr/bin/env bash -e
# Cool stuff from http://dave.cheney.net/2013/06/19/stress-test-your-go-packages
go test -c
# comment above and uncomment below to enable the race builder
# go test -c -race
PKG=$(basename $(pwd))
while true ; do
@ef2k
ef2k / gist:f8f9b5a1d689ac55e721
Last active August 29, 2015 14:01
Detect a Mobile Device (Taken from the interwebs)
// ORIGINAL:
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}
// My helper property:
window._IS_MOBILE_DEVICE = (function () {
@ef2k
ef2k / favicon.ico
Created February 16, 2014 21:48
Favicon boom!
<link href="data:image/x-icon;base64,AAABAAEAEBAAAAAAAABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD9/f0F/Pz8DP///wD///8P////Dv///xL///8P////A////wD///8A/v7+Cf///wX///8A////APv7+wr9/f0D+/v7Dv///wb///81+vv8i/v7/Iv3+PqL4+nxi+ru9JHy9Piu5+zzru3w9ZD+/v5x/v7+H////wr///8A9/f3H/7+/g7///8J////HNDX5Pyaq8j/m6zJ/5esy/+QpcX/larK/5uwzv+MoMH/mqrG/5qlv+7Q0Nty/f3+Af///wD///8A/v7+A////wz+/v6b2d/q/4abvf+Emr7/jKHD/5Gnyf+Uqsz/fpW5/4mXuP/U1OL/e3ui+MPE0l7///8A////AP///wD///8P////Xa680/9/lrr/kafJ/5yy0/+WrM7/nbPT/52uyv+ktM7/1NTi/8LC1f+lpr3n////AP///wD///8A////AP7+/mDo7PL/ytPi/5yv0fehsuXuuMvl0Kq81drS2uf8+/z9bff3+SG5uM1r8vL1ff///wD///8A////AP///wr+/v4H/v7+jufq8umIg/Sut7L9YKul/W7PzvlMnZn03Ozq/x/+/v4H////AP///wD///8A////AP///wD///8A5OH/IpuS/pF3cfPploz/hH5y/6F/dP+gl47/gkw++e7Hwv9Fta//XPj4/gf///8A////AP///wD///8A+vn/BoyB/pGlnf5vfHfxy4mA/JlIOf/lmZD+f1lK/89kWPrPmZD+f9zY/yu3sP5ar6j/ZP///wD///8A6uj/GbSt/l6imv9yVkf/1HBm+MJ5eOrlhX/1s2JY+dRpYPfPv7/zb4+F/41WR//Uloz/hI6E/47///8A////AOro/xmnn/9teW3/qH5y/6HKxf9B9/n7Fc3N9VfMyvlQraj
@ef2k
ef2k / rowFilter
Created February 3, 2014 17:37
Row filtering
$('input.filter').live('keyup', function() {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function() {
return rex.test($(this).text());
}).show();
});
@ef2k
ef2k / gist:8421412
Created January 14, 2014 16:44
Workaround for Safari back-forward cache
$(window).on('pageshow', function (evt) {
if (evt.originalEvent.persisted) {
window.location.reload();
}
});
@ef2k
ef2k / gist:8141580
Created December 27, 2013 02:15
NPM without sudo
sudo chown -R `whoami` /usr/local/lib
@ef2k
ef2k / .bash_profile
Created December 17, 2013 18:21
Getting dot file set up on the mac
export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH
export EDITOR='subl -w'
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@ef2k
ef2k / gist:7157599
Created October 25, 2013 16:33
Clone and add remote branches to your project.
git clone https://github.com/brooklyndevs/metroly-html5.git
git branch dev origin/dev
# At this point you have master and dev branch
# You can check what branch you are on by typing:
git branch
# To switch between branches use the git checkout followed by the branch name:
git checkout dev
@ef2k
ef2k / gist:6956450
Created October 13, 2013 00:12
Git config to push to multiple destinations.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "all"]
url = [email protected]:3DprintFIT/skeinforge-online.git
url = ssh://[email protected]/~/git/skeinforge.git/
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*