Skip to content

Instantly share code, notes, and snippets.

View chrisdhanaraj's full-sized avatar

Chris Dhanaraj chrisdhanaraj

View GitHub Profile
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
#RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@chrisdhanaraj
chrisdhanaraj / gist:3641aec8189527a0226f
Last active August 29, 2015 14:07
JS Jamz Quiz #1
// Write a function that returns its argument.
// Write a function that takes a name and returns the length of the name.
// Write a function that takes two numbers, adds them, and returns the result.
// Write a function that takes an object and adds the key:value pair of "France" : "Paris" to it. Return the object.
@chrisdhanaraj
chrisdhanaraj / definitions
Created October 20, 2014 21:17
Definitions of Javascript: JS JAMZ #3
// Defintions
// Numbers
// 4, 5, 28, 1003, 42, 3.423
var meaningoflife = 42;
console.log(meaningoflife); // 42 - no quotations, no brackets, no squigglies, no nuthin'
// math operations
$( '.carousel' ).cycle({
fx: 'carousel',
timeout: 0
});
$('.next').on('click', function() {
nextSlide();
});
@chrisdhanaraj
chrisdhanaraj / gist:b483a691e997165a797b
Last active August 29, 2015 14:08
Advanced Carousel
function carousels(element, jump) {
var carousel;
carousel = $(element).cycle({
fx: 'carousel',
timeout: 0,
allowWrap: false
});
var totalSlides = $(element).data('cycle.opts').slideCount;
FLEXY.JS
A stab at writing a horizontal-filling grid-system (as opposed to jQuery Masonry’s vertical fill) and a chance to explore some base-level usage of the lodash library.
GA-ANALYTICS.JS
My first foray into writing event tracking for Google Analytics. This snippet can be dropped into any website and will automatically setup video analytics for YouTube videos. I have a partner script that does the same for HTML5 vidoes (seen here).
PROJECT FAST
A MEAN app (though possibly under going a rewrite in React) that will become a character creator/manager for a table-top RPG developed by Bret Stevens.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/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=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt get update && sudo apt-get install yarn git make build-essential