Skip to content

Instantly share code, notes, and snippets.

View Pushplaybang's full-sized avatar
:octocat:
0_0

Paul Pushplaybang

:octocat:
0_0
View GitHub Profile

Big Name Apps

App App Store size App App Store size
Facebook 41.6mb Trello 14.27mb
Twitter 21.55mb TED 8.79mb
Instagram 12.86mb Stack Exchange 8.2mb
Chrome 54.39mb Audible 35.75mb
firefox 39.33mb Xero 6.65mb
Uber 18.3mb Google Music 18.54mb
@Pushplaybang
Pushplaybang / .eslintrc
Created February 27, 2016 13:04
eslintrc setup
/*
======= REMOVE THESE COMMENTS =========
```sh
// eslint
npm install -g eslint
npm install -g babel-eslint
npm install -g eslint-plugin-react
```
You'll want to setup an `.eslintrc` file in your root directoey, and if you'd like to use the one defined here, you'll need to install the airbnb eslint config locally as it extends it.
@Pushplaybang
Pushplaybang / publications.js
Created July 5, 2015 20:31
Meteor reactive publication across collections (essentially a join)
// on the server
Meteor.publish('comments', function(id) {
check(id, String);
var sub = this, userHandles = [], commentsHandle = null, userCursor;
// send over the author for the comment
var publishCommentAuthor = function publishCommentAuthor(authorId) {
userCursor = Meteor.users.find({ _id: authorId});
userHandles[authorId] =
Mongo.Collection._publishCursor(userCursor, sub, 'users');
@Pushplaybang
Pushplaybang / regex.js
Last active August 29, 2015 14:23
My JS regex ref
// HashTags
var simpleHash = /#\w+/g;
var complexHash = /\B#\w*[a-zA-Z]+\w*/g; // this seems uneccessary
// eg :
var input = "this is a #string with #tags to be #extracted";
var matches = input.match(sinpleHash);
var matches = input.match(complexHash);
// email
@Pushplaybang
Pushplaybang / CountryList.js
Last active August 29, 2015 14:21
Country Name and Code JSON
/* Prepared for autoForm select options */
countryList = [
{label: "Afghanistan", value: "AF"},
{label: "Åland Islands", value: "AX"},
{label: "Albania", value: "AL"},
{label: "Algeria", value: "DZ"},
{label: "American Samoa", value: "AS"},
{label: "AndorrA", value: "AD"},
{label: "Angola", value: "AO"},
{label: "Anguilla", value: "AI"},
@Pushplaybang
Pushplaybang / rot_cipher.js
Last active August 29, 2015 14:20
Javascript Rotation Cipher
/*
Rotation Ciphers
*/
var RotCipher = (function() {
var alpha = "abcdefghijklmnopqrstuvwxyz";
var obj = {
result : "",
@Pushplaybang
Pushplaybang / fischer_yates_shuffle.js
Created April 27, 2015 12:21
Fischer Yates Shuffle in Javascript
//as a function
function shuffleFischerYates(arr) {
var i = arr.length, j, temp;
while (--i > 0) {
j = Math.floor(Math.random()*(i+1));
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}
@Pushplaybang
Pushplaybang / playing_cards_ex.js
Last active August 29, 2015 14:20
Playing Cards Deck module in javascript with human shuffling (rough - needs re-factoring)
// intentionally create a global
Deck = function Deck() {
// TODO : make appropriate vars settable
var Suits = ['c', 'h', 'd', 's'],
Pack = [],
cardsOut = [],
cardCount = 52,
rv = 6, // riffleVariance
cv = 10, // cutVariance
@Pushplaybang
Pushplaybang / rangefunction.js
Created April 25, 2015 21:39
Javascript range function
var range = function(start, end, step) {
var range = [];
var typeofStart = typeof start;
var typeofEnd = typeof end;
if (step === 0) {
throw TypeError("Step cannot be zero.");
}
if (typeofStart == "undefined" || typeofEnd == "undefined") {