Skip to content

Instantly share code, notes, and snippets.

View rodleviton's full-sized avatar
⛰️

Rodney Leviton rodleviton

⛰️
View GitHub Profile
@rodleviton
rodleviton / bs3-megamenu-intelligence.js
Last active August 29, 2015 14:01
Bootstrap Mega Menu Responsive Intelligence
// Handle Mega Menu Positioning
// Requires Yamm Mega Menu Plugin for Bootstrap3 (http://geedmo.github.io/yamm3/)
$('li.dropdown > a').on('click', function () {
var screenWidth = $(window).width();
var xPos = $(this).offset().left;
var parent = $(this).parent('.dropdown');
var dropdownWidth = $('.dropdown-menu', parent).width();
if ((xPos + dropdownWidth) > screenWidth) {
@rodleviton
rodleviton / gulpfile.js
Last active August 29, 2015 14:01
Basic gulp file to get project up and running
var gulp = require('gulp'),
minifycss = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
notify = require('gulp-notify'),
sass = require('gulp-ruby-sass'),
rename = require('gulp-rename');
gulp.task('css', function() {
return gulp.src('public/assets/sass/application.scss')
.pipe(sass({ style: 'expanded' }))
/*
* An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of
* localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries
* Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`.
*
* @author: benmj
* @author: amir.valiani
*
* Original source: https://gist.github.com/benmj/6380466
*/
@rodleviton
rodleviton / generator.js
Created July 17, 2014 11:37
Random element generator
var Generator = window.Generator || {};
Generator = (function() {
'use strict';
var container; // Container to append items to and get size constraints
function init(id, total, className) {
container = document.getElementById(id);
// Full Blog Post: http://viget.com/extend/time-based-animation
// requestAnimationFrame() polyfill: https://gist.github.com/1579671
window.APP = window.APP || {};
APP.pause = function() {
window.cancelAnimationFrame(APP.core.animationFrame);
};
APP.play = function() {
#https://gorails.com/setup/ubuntu/14.04
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
@rodleviton
rodleviton / node-upgrade-osx
Created August 28, 2014 02:26
Node upgrade OSX
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@rodleviton
rodleviton / npm-sudo-fix
Last active August 29, 2015 14:09
NPM Sudo Fix
# You need to reclaim ownership of the .npm directory
sudo chown -R <username> ~/.npm
# And need the write permission in node_modules directory
sudo chown -R <username> /usr/local/lib/node_modules
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
@rodleviton
rodleviton / gist:7076764
Created October 20, 2013 23:50
JavaScript: jQuery Extend Plugin
$.extend($.fn.pluginName, {
// Override methods here
};