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
/* | |
* Implementation of Vose's Alias Method | |
* Pass in an array of probabilities such as [.1, .2, .4, .7], | |
* probabilities do not have to add up to 1. | |
* Returned will be the selected index based on the probabilities. | |
* | |
* show statistics with | |
* aliasMethod(yourArray, true); | |
* | |
* use with |
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
/* | |
Sample object that should work is: | |
var exampleObj = { | |
tag: 'div', | |
attr: { | |
id: '1234', | |
href: 'some/url/path', | |
class: ['createdElement', 'example', 'parent'], | |
text: 'some text' | |
}, |
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
var keys = {}; | |
$('#notes') | |
.live('keydown', function(e){ | |
keys[e.keyCode] = 'down'; | |
console.log(keys); | |
}) | |
.live('keyup', function(e){ | |
delete keys[e.keyCode]; | |
console.log(keys); | |
}); |
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
/** | |
* @fileOverview LocalStorageHelper RequireJS AMD Module File | |
* | |
* @author Russell Dempsey <[email protected]> | |
* @version 1.0 | |
*/ | |
define(function(require, module, exports) { | |
'use strict'; | |
//includes |
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
/** | |
************************************************************************************************************* | |
***** This will no longer lock up your browser tab, but it will not find a match for a very long time **** | |
***** Do not run this in a tab you do not want to reload **** | |
************************************************************************************************************* | |
* | |
* This was just me playing around trying to see if I could get a duplicate random string | |
* when using the Math.random().toString(radix) method. | |
* | |
* I had planned to implement web workers with this as well so that I could let it |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir $HOME/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=$HOME/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
#curl https://npmjs.org/install.sh | sh # this is no longer required |
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
# Apache Rewrite Rules | |
<IfModule mod_rewrite.c> | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteBase / | |
#RewriteLog /var/rewrite.log RewriteLogLevel 9 | |
# Redirect to URL without extension. (remove .php) | |
RewriteCond %{THE_REQUEST} ^[A-Z]+\s.+\.php\sHTTP/.+ | |
RewriteRule ^(.+)\.php $1 [R=301,L] |
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
sudo pacman -Syy | |
sudo pacman -S --noconfirm python2 wget git make gcc vim | |
sudo mv /usr/bin/python /usr/bin/python-BAK | |
sudo ln -s /usr/bin/python2 /usr/bin/python | |
source <(curl -s https://gist.githubusercontent.com/SgtPooki/7667376/raw/node-and-npm-in-30-seconds.sh) |
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
@echo off | |
REM loopNum defaults to 1, caps at 10. | |
REM see https://gist.github.com/SgtPooki/99e12f32a874aa7dd3b2 | |
SET loopNum=1 | |
If not "%~1"=="" ( | |
SET loopNum=%1 | |
) | |
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
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:git-core/ppa | |
sudo apt-get update | |
sudo apt-get install -y git curl python-software-properties libcurl3 libcurl3-gnutls libcurl4-openssl-dev | |
OlderNewer