Skip to content

Instantly share code, notes, and snippets.

View DanWilkerson's full-sized avatar
🐢
What's happening?

Dan Wilkerson DanWilkerson

🐢
What's happening?
View GitHub Profile
@DanWilkerson
DanWilkerson / test.bootstrap.js
Last active January 12, 2018 16:23
Testing Policies in Sails JS ^v0.12
/**
* Exposes policies during testing to allow for stubbing when testing controllers.
* Useful when you need to bypass a policy for authorized controllers.
*
* Originally created by @joepuzzo (https://github.com/joepuzzo)
* Updated by @notdanwilkerson (https://github.com/notdanwilkerson)
*
* Usage (in test file):
*
* let authStub;
@DanWilkerson
DanWilkerson / gist:a90684b2491947ce31b61809421a8dc8
Created October 11, 2016 18:16
Google Analytics Client ID Generator
/**
* Generates a client ID in the format historically used by the Google Analytics
* JavaScript libraries. Note that any alphanumeric value may be used, but
* ideally each should be unique to a given client.
*
* More information on Client IDs:
* https://developers.google.com/analytics/devguides/collection/protocol/v1/email#client-id-cid
*/
function generateGaClientId() {
@DanWilkerson
DanWilkerson / gist:7423507
Created November 12, 2013 00:58
My #code140 submission - a function that counts from 1 to 100, replacing multiples of 3 with 'Fizz', multiples of 5 with 'Buzz', and multiples of 3 & 5 with 'FizzBuzz'.
(function (){
for(i = 1; i < 101; i++) {
if (i % 3 === 0 && i % 5 === 0) {
console.log('FizzBuzz');
} else if (i % 3 === 0) {
console.log('Fizz');
} else if (i % 5 === 0) {
console.log('Buzz');
} else {
console.log(i);
@DanWilkerson
DanWilkerson / gist:7371808
Created November 8, 2013 14:31
Fibonacci Generator in Javascript for #Code140. Requires BigInteger by SilentMatt. Working web application using below code can be found at http://www.danwilkerson.com/apps/code140/fibonacci/fibonacci.html
/***** Dan Wilkerson * @notdanwilkerson *****/
// Simple function to return the value of the nth number of the Fibonacci sequence.
// Requires BigInteger by silentmatt ( http://silentmatt.com/biginteger/ )
// To see a working webapplication that uses this code visit
// http://www.danwilkerson.com/apps/code140/fibonacci/fibonacci.html
function fibonachocheese(number){
if (number % 1 !== 0 || number < 0 || number > 100000) {