Skip to content

Instantly share code, notes, and snippets.

View omgmog's full-sized avatar
⌨️

Max Glenister omgmog

⌨️
View GitHub Profile
@omgmog
omgmog / alert.cocoascript
Last active August 29, 2015 14:27
CocoaScript implementation of alert()
var alert = function (message) {
var alertDialog = [[NSAlert alloc] init]
[alertDialog setMessageText:message]
[alertDialog addButtonWithTitle: 'OK']
var responseCode = [alertDialog runModal]
return [responseCode]
}
@omgmog
omgmog / userstyle.css
Created September 10, 2015 15:39
Improved layout for www.theinquirer.net
@-moz-document domain("www.theinquirer.net") {
@media screen {
#content-left-main {
background: #fff;
}
#leftcol,
#rightcol,
#centercol,
.inq_left_block,
.inq_right_block {
@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 / 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
}