Skip to content

Instantly share code, notes, and snippets.

View jakiestfu's full-sized avatar
🌺

Jacob Kelley jakiestfu

🌺
View GitHub Profile
@jakiestfu
jakiestfu / rdiff.sh
Last active August 29, 2015 13:57
Git Remote Diff: Open the latest commit diff in GitHub
git config --global alias.rdiff '!g() { origin=`git config --get remote.origin.url`; origin=${origin/git@github.com:/https://github.com/}; url=${origin/.git/\/commit\/`git rev-parse HEAD`}; open $url; }; g'
@jakiestfu
jakiestfu / ko-else.js
Created May 28, 2014 05:42
This is an almost working "else" binding for Knockout.js. It monkey patches the "if" binding and keeps a stack of the last returned values from the bindings. Every "else" binding is actually an if binding with the negated value of the last if bindings return set in a preprocessor. Currently doesn't work with multiple bindings. DOH!
(function(){
var bindingKey = 'else',
stack = [],
_if = ko.bindingHandlers.if,
_init = _if.init
_update = _if.update;
ko.bindingHandlers[bindingKey] =
{
@jakiestfu
jakiestfu / ko.else.js
Created October 17, 2014 14:50
An attempt to create an "else" binding with Knockout. Only supports linear statements, no depth.
(function(){
var bindingKey = 'else',
stack = [],
_if = ko.bindingHandlers.if,
_init = _if.init
_update = _if.update;
ko.bindingHandlers[bindingKey] =
{
@jakiestfu
jakiestfu / spacing.css
Last active August 29, 2015 14:08
Creates a bunch of helpful padding/margin classes
.margin { margin: 10px; }
.no-margin { margin: 0 !important; }
.m-top { margin-top: 5px !important; }
.m-top-more { margin-top: 10px !important; }
.m-right { margin-right: 5px !important; }
.m-right-more { margin-right: 10px !important; }
.m-bottom { margin-bottom: 5px !important; }
.m-bottom-more { margin-bottom: 10px !important; }
.m-left { margin-left: 5px !important; }
.m-left-more { margin-left: 10px !important; }
@jakiestfu
jakiestfu / README.md
Last active August 29, 2015 14:15
A super useful function for creating elements
var div = _e('div');

var btn = _e('input', {
  type: 'button',
  value: 'Click Me',
  on: {
    click: function(e) { alert('Hello'); }
  }
});
#!/bin/bash
# This is a comment
//if($request_url)...
// Save GET queries
$parsedUrl = parse_url(home_url($request_url));
if($parsedUrl['query']){
$queries = explode('&',$parsedUrl['query']);
foreach($queries as $query){
$queryInfo = explode('=',$query);
$_GET[$queryInfo[0]]=end($queryInfo);
}
@jakiestfu
jakiestfu / twitPuff.js
Created August 17, 2012 17:08
Twitter iOS Puff
var twitPuff = (function () {
function openPuff(imgUrl) {
if (typeof imgUrl == undefined) {
return;
}
$('#tw-puff-blanket').css({
display: 'block',
lineHeight: window.innerHeight + 'px'
});
$('#tw-puff-blanket').html('<img>');
@jakiestfu
jakiestfu / context.css
Created August 28, 2012 23:03
Contextual Menus with Twitters Bootstrap
.dropdown-context .nav-header{
cursor:default;
}
.dropdown-context:before, .dropdown-context-up:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
@jakiestfu
jakiestfu / metro-parallax.js
Created September 10, 2012 21:05
Background Parallax for Metro-UI-CSS
var coefficient = 10;
$('.metro-scroll').scroll(function(e){
var bgpos = Math.floor((this.scrollLeft/coefficient)*-1) + 'px 0px';
$('body').css('background-position', bgpos);
});