Skip to content

Instantly share code, notes, and snippets.

@redroot
redroot / gist:3c7948ec92ecbd3bdf1d
Created May 4, 2014 23:18
Example JS Module pattern
var Header = (function(w,d,undefined)){
var _elem = null;
var bindButtons = function(){
$(document).on('click', _elem.find(".js-toggle-sidebar"), function(){
Sidebar.toggle(); //
});
}
@redroot
redroot / gist:6d61068c8f89ce34041d
Created May 4, 2014 23:29
Something for a web post
<div class='box box-light'>
<div class='box-title'>...</div>
<div class='box-inner'>...</div>
</div>
@redroot
redroot / gist:baafafed43dc6269904f
Created May 4, 2014 23:32
SASS & directive example
.box {
padding: 10px;
...
&.is-active {
}
&.is-inactive {
@redroot
redroot / Button Code
Last active August 29, 2015 14:01
Arduino Dumping Ground
int motorA = 3;
int button = A0;
int motorValue = 130;
// set voltage in power supply to 7.1, current fll (0.15k)
void setup()
{
pinMode(button, OUTPUT);
Serial.begin(9600);
}
@redroot
redroot / broken.rb
Last active August 29, 2015 14:01
How to get bundler command line working inside bundle exec
namespace :update do
task :services do
REPOS.each do |repo_path|
uncommitted_files = `cd #{repo_path} && git status --porcelain | wc -l`.strip.chomp.to_i
if uncommitted_files == 0
puts "Updating #{repo_path} ..."
puts `cd #{repo_path} && bundle update config-gem`
namespace :update do
task :services do
REPOS.each do |repo_path|
uncommitted_files = `cd #{repo_path} && git status --porcelain | wc -l`.strip.chomp.to_i
if uncommitted_files == 0
puts "Updating #{repo_path} ..."
puts `cd #{repo_path} && BUNDLE_GEMFILE=#{repo_path}/Gemfile bundle update config-gem`
@redroot
redroot / HTML ie helper head
Last active August 29, 2015 14:04
SASS parts and HTML5 <html> tag
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
</head>
<body>
</body>
</html>
ruby:
`du -h`
# error when running in passenger:
Error message:
No such file or directory - du -h
Exception class:
Errno::ENOENT
//e.g.
var _ = require('underscore');
var common_model_extensions = require('lib/util/model_extensions').common;
// which would be:
module.exports = {
common: {
classMethods: {
updateById: function(id, data, cb){
@redroot
redroot / gist:3a8f4ad8b5ab109a6922
Created March 23, 2015 08:10
Work Q deferred method with promises
'use strict';
var _ = require('underscore');
var Q = require('q');
var to_run = {
'one': function(date){
var deferred = Q.defer();
setTimeout(function(){
console.log("Im number one!", date);