Skip to content

Instantly share code, notes, and snippets.

View omgmog's full-sized avatar
⌨️

Max Glenister omgmog

⌨️
View GitHub Profile
@omgmog
omgmog / gist:1836735
Created February 15, 2012 15:36
Specific case for breaking up page in to slides that slide in/out of viewport.
$(function(){
$("section.page").hide();
var hash = window.location.hash;
if(hash){
$('a[href$="'+hash+'"]').parent().addClass('active').siblings('li.active').removeClass("active");
$('section'+hash).show();
console.log(hash);
check_for_dark($('section'+hash));
}else{
@omgmog
omgmog / .screenrc
Created March 27, 2012 11:29
my .screenrc, goes in ~/.screenrc
startup_message off
screen -t serve
screen -t git
select 0
autodetach on
term screen-256color
termcapinfo xterm-256color|xterm-color|xterm|xterms|xs|rxvt ti@:te@
altscreen on
hardstatus on
@omgmog
omgmog / jquery_disqus_lazyload.js
Created April 5, 2012 13:19 — forked from muratcorlu/jquery_disqus_lazyload.js
Load disqus comments when visitor scroll down page to comments
/**
* Load disqus comments when visitor scroll down page to comments
*
* Usage:
* Add a div with id "disqus_thread" and data attributes for every disqus parameter:
*
* <div id="disqus_thread" data-disqus-shortname="username" data-disqus-url="http://example.com/post/post-name/"></div>
*
* @author: Murat Corlu
* @link: https://gist.github.com/gists/2290198
@omgmog
omgmog / gist:2420059
Created April 19, 2012 10:01
Bulk recursive find/replace in terminal with perl/grep
perl -pi -w -e 's/<search string>/<replace string>/g;' `grep -ril "<search string>" *`
@omgmog
omgmog / gist:2421164
Created April 19, 2012 14:00
gatt - git all the things!
# place this in your ~/.bashrc
# restart terminal, or run 'source ~/.bashrc'
# use `gatt` command like a bowss
# ???
# Profit!
# name/idea/demand from @tmayr
# gatt "branch" "message"
# or
# gatt "message"
@omgmog
omgmog / gist:2690184
Created May 13, 2012 21:03
jQuery snippet for embedding YouTube videos with custom thumbnails
$(function(){
$('.ytembed:not(.processed)').addClass('processed').each(function() {
$(this).find('a').click(function(e) {
e.preventDefault();
var width = $(this).find('img').width();
var height = $(this).find('img').height();
var url = $(this).attr('href');
var $iframe = $('<iframe src="'+url+'" width="'+width+'" height="'+height+'" frameborder="0"/>');
$(this).parent().html($iframe);
});
@omgmog
omgmog / gist:2690199
Created May 13, 2012 21:05
HTML to accompany the jQuery at gist:2690184
<!-- you need a div with the class 'ytembed' -->
<div class="ytembed">
<!-- put a link with the url + embed options of your video -->
<a href="http://www.youtube.com/watch?v=dQw4w9WgXcQ?rel=0&amp;showinfo=0&amp;autohide=1&amp;autoplay=1&amp;wmode=transparent">
<!-- and a thumbnail, with the width/height specified -->
<img width="560" height="315" src="/path/to/custom_thumbnail.jpg" alt="Click to play"/>
</a>
</div>
@omgmog
omgmog / snippet.md
Created June 20, 2012 15:30 — forked from harthur/snippet.md
console.log() key binding for Sublime Text

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

[
    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
      }
 }
@omgmog
omgmog / gist:3040431
Created July 3, 2012 15:23
workdone [time period] [committer email]
# Usage:
# workdone [time period] [committer email]
workdone(){
default="1 day ago"
email="[your email here]"
git log --committer=${2:-$email} --pretty=format:"%Cgreen%ar (%h)%n%Creset> %s %b%n" --since="${1:-$default}" --no-merges
}
@omgmog
omgmog / .screenrc
Created October 4, 2012 13:57
my .screenrc
startup_message off
screen -t serve
screen -t git
select 0
autodetach on
term screen-256color
termcapinfo xterm-256color|xterm-color|xterm|xterms|xs|rxvt ti@:te@
altscreen on
hardstatus on