Skip to content

Instantly share code, notes, and snippets.

View simshanith's full-sized avatar
p̟̖̹h̯͎͙̺̤̤ͅi̜l͓͖̟͎̬̺̰o̧̻̝͖͍̻̥s̝̪̪̣͕o͍̮͖r̛̦̲̫̱̞̜̞a̸͎p͇͙̪̀t͇͖ò̙̦͈̘̣ṛ̟͕

Shane Daniel simshanith

p̟̖̹h̯͎͙̺̤̤ͅi̜l͓͖̟͎̬̺̰o̧̻̝͖͍̻̥s̝̪̪̣͕o͍̮͖r̛̦̲̫̱̞̜̞a̸͎p͇͙̪̀t͇͖ò̙̦͈̘̣ṛ̟͕
View GitHub Profile
@simshanith
simshanith / grunt.js
Last active December 31, 2015 21:08
Grunt templates to the rescue!
module.exports = function(grunt) {
grunt.initConfig({
concat : {
options: {
paths: {
src: 'assets/css',
dest: 'temp'
}
@simshanith
simshanith / rabbitHello.clj
Last active December 29, 2015 12:29
Clojure RabbitMQ Langohr "Hello World" example as an executable command-line script
#!/usr/bin/env lein-exec
(require 'leiningen.exec)
(leiningen.exec/deps '[[com.novemberain/langohr "1.4.1"]])
(ns clojurewerkz.langohr.examples.hello-world
(:gen-class)
(:require [langohr.core :as rmq]
[langohr.channel :as lch]
[langohr.queue :as lq]
[langohr.consumers :as lc]
14:13:10 ⑆ [sdaniel@sim-vmlmac]
~/Code/gcom-static/trunk
svn [✓]
λ cp -vf htdocs/_assets/css/*.css ~/Code/gcom/trunk/src/gcom/_assets/css/
λ cp -vf htdocs/_assets/js/*.js ~/Code/gcom/trunk/src/gcom/_assets/js/
λ svn export htdocs/_assets/images/ ~/Code/gcomimages/
λ cp -rvf ~/Code/gcomimages/ ~/Code/gcom/trunk/src/gcom/_assets/images/
λ svn export htdocs/science-of-g/_assets/ ~/Code/sogAssets/
λ cp -rvf ~/Code/sogAssets/ ~/Code/gcom/trunk/src/gcom/science-of-g/_assets/
@simshanith
simshanith / example.dev.html
Last active December 16, 2015 15:29
Building dev & production HTML with Jade & Grunt.
<!DOCTYPE html><!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]--><!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]--><!--[if IE 8]><html class="no-js lt-ie9"><![endif]--><!--[if gt IE 8]><!-->
<html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<title>Example Jade Template</title>
<script src="/_assets/js/modernizr-2.6.2.min.js"></script>
</head>
<body>
<h1>Example Jade Template</h1>
@simshanith
simshanith / gruntfile.js
Last active December 15, 2015 20:49
Grunt file that builds Stylus, Jade, & minified JavaScript, and watches for changes to source files.
module.exports = function(grunt) {
// Load all of our NPM tasks...
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-stylus');
@simshanith
simshanith / querystring.js
Created April 5, 2013 15:53
Pull name/value pairs from URL query string
function querystring(key) {
var re=new RegExp('(?:\\?|&)'+key+'=(.*?)(?=&|$)','gi');
var r=[], m;
while ((m=re.exec(document.location.search)) != null) r.push(m[1]);
return r;
}
@simshanith
simshanith / windowScroll.js
Last active December 15, 2015 06:19
Progressively enhanced cross-browser scrolling, via Modernizr, jQuery Transit, and classic $.scrollTo fallback
var sliding = false; // variable outside function scope to detect a slide is in progress
function slideTo(target, duration){ // credit to Mahieddine Abdelkader & Ludwig Wendzich for original ideas.
var to = isNaN(target) ? $(target).offset().top : target, //find scroll to position
from = $(window).scrollTop() //find starting point
dy = to-from, //calculate change in scroll position - deltaY
body = $("body"), // TODO: better to have it outside of local scope already rather than fetching it every time...
duration = isNaN(duration) ? 500 : duration;
// We're going to use translate-y to move the the page so it feels like we're at the *from* scroll position, when we're actually instantly at the *to* scroll position. */
@simshanith
simshanith / Example Backbone app JS skeleton.html
Last active December 12, 2015 06:08
Example Backbone app JS skeleton
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example Backbone Skeleto</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<style>
.hidden{
display: none !important;
}
// example anonymous function
var doop = (function(){var thisFunc = arguments.callee; thisFunc.foo = 'bar'; return arguments.callee.foo;});
// returns null
doop.foo;
// ...until it's called once. both return "bar".
doop();
doop.foo;
<!DOCTYPE html>
<html class="en">
<head>
<meta charset="utf-8">
<title>Example Facebook Page Like Box</title>
</head>
<body>
<div id="fb-root"></div>
<div id="main-wrapper" style="height: 100%;">
</div><!-- end main wrapper -->