Skip to content

Instantly share code, notes, and snippets.

View jem-computer's full-sized avatar
🌈

Jem jem-computer

🌈
View GitHub Profile
function handleScroll() {
$(window).scroll(_.throttle(
function(){
radFunction();
// needed to wrap this function call in an anonymous function
// to get things working. *shrug*
}, 300)
);
}
// =funcs
// == clear (overrides clear to give clear fix)
clear(arg)
if arg is "fix"
&:before
&:after
content: " "
display: table
&:after
clear: both
# Todo
alias todo='$EDITOR ~/.todo'
# Unix
alias tlf="tail -f"
alias ln='ln -v'
alias mkdir='mkdir -p'
alias ...='../..'
alias l='ls'
alias ll='ls -al'
//
// JGHypnosisView.m
// Hypnosister
//
// Created by Jon Gold on 25/11/2012.
// Copyright (c) 2012 Jon Gold. All rights reserved.
//
#import "JGHypnosisView.h"
#import <CoreMotion/CoreMotion.h>
@jem-computer
jem-computer / eden.scss
Created November 7, 2012 16:20 — forked from daneden/gist:4032573
Sass media queries and @extend
// Fairly safe way to visually hide content, but make it accessible to screen readers
.visually-hidden {
position: absolute;
left: -9999px;
height: 1px;
}
.mobile-offscreen {
@media screen and (max-width: 700px) {
@extend .visually-hidden;
@jem-computer
jem-computer / appdelegate.rb
Created October 31, 2012 16:27
Speech Synthesis in MacRuby
framework 'AppKit'
module AppDelegate
extend self
def applicationDidFinishLaunching(notification)
voice_type = "com.apple.speech.synthesis.voice.GoodNews"
@voice = NSSpeechSynthesizer.alloc.initWithVoice(voice_type)
end
// Love rems
=font-size($sizeValue: 1)
font-size: ($sizeValue * 16) + px
font-size: $sizeValue + rem
// http://csswizardry.com/2012/06/single-direction-margin-declarations/
// Could probably rewrite this into one mixin
=margin-right-rem($margin: 1.6)
margin-right: ($margin * 16) + px
margin-right: $margin + rem
// http://csswizardry.com/2012/06/single-direction-margin-declarations/
=font-size($sizeValue: 1)
font-size: ($sizeValue * 16) + px
font-size: $sizeValue + rem
=margin-top-rem($margin: 1.6)
margin-top: ($margin * 16) + px
margin-top: $margin + rem
=margin-right-rem($margin: 1.6)
directory "tmp"
file "tmp/hello.tmp" => "tmp" do
sh "echo 'Hello' > 'tmp/hello.tmp'"
end
task :default => 'morning:turn_off_alarm'
namespace :morning do
desc "Turn off alarm."
// Either of the following two patterns can be used to immediately invoke
// a function expression, utilizing the function's execution context to
// create "privacy."
(function(){ /* code */ }()); // Crockford recommends this one
(function(){ /* code */ })(); // But this one works just as well
// Because the point of the parens or coercing operators is to disambiguate
// between function expressions and function declarations, they can be