Skip to content

Instantly share code, notes, and snippets.

View ifahrentholz's full-sized avatar
👨‍💻
workin

Ingo Fahrentholz ifahrentholz

👨‍💻
workin
View GitHub Profile
@ifahrentholz
ifahrentholz / jquery-plugin-boilerplate
Last active December 16, 2015 05:19
A boilerplate for jumpstarting jQuery plugins development
/**
* *******************************
* XOLOTL jQuery-lightbox Plugin *
* *******************************
* @author Ingo Fahrentholz *
* @since Version 0.1.0 *
* *******************************
*/
!function(exports, $, undefined) {
@ifahrentholz
ifahrentholz / plugin-boilerplate.js
Last active December 18, 2015 09:59
jquery plugin boilerplate v2
/*
Immediately-Invoked Function Expression (IIFE) [Ben Alman Blog Post]
(http://benalman.com/news/2010/11/immediately-invoked-function-expression/)
that locally passes in `jQuery`, the `window` object, the `document` object,
and an `undefined` variable. The `jQuery`, `window` and `document` objects
are passed in locally to improve performance (JavaScript first searches for
a variable match within the local variables set before searching the global
variables set). All of the global variables are also passed in locally to
be minifier friendly. `undefined` can be passed in locally, because it is not
a reserved word in JavaScript
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"draw_white_space": "selection",
"file_exclude_patterns":
[
"*.png",
"*.gif",
"*.swp",
"*.scssc",
".DS_Store",
@ifahrentholz
ifahrentholz / ev.onload.js
Created July 27, 2013 14:57
Calculate difference between zero and window.onload
<script>
// calculate difference between zero and window.onload
window.onload = function () {
var stop = new Date();
document.getElementById("content").style.display = "block";
document.getElementById("ms").innerHTML = (stop - start);
};
</script>
...
<script>
@ifahrentholz
ifahrentholz / gist:7b8eabf12c06a05a664e
Last active August 29, 2015 14:15
Preserve License Comments
uglify: {
options: {
mangle: {
except: ['jQuery']
},
preserveComments: 'some',
banner: '<%= banner %>',
report: 'min'
},
my_targets: {
alias tma='tmux attach -d -t'
alias git-tmux='tmux new -s $(basename $(pwd))'
alias tksa='tmux kill-session -a'
alias tks='tmux kill-session '
alias tls='tmux list-sessions'
// ---------------------------------
// ---------- Plugin Name ----------
// ---------------------------------
// Brief plugin description
// ------------------------
/*
The semi-colon before the function invocation is a safety net against
concatenated scripts and/or other plugins which may not be closed properly.
$dspace: 24px;
$space--xs: round(0.25 * $dspace);
$space--s: round(0.5 * $dspace);
$space--m: round(2 * $dspace);
$space--l: round(4 * $dspace);
@mixin sizes($properties...) {
&--tiny {
@each $property in $properties {
@ifahrentholz
ifahrentholz / cherry-picking.txt
Created November 23, 2015 13:15
Description for the right cherry-pick workflow
Cherry-Picking specific commits from another branch
10 June, 2010 • tagged cherry-pick, git and scm • 323 words • ~2 minutes
I’m often asked how to merge only specific commits from another branch into the current one. The reason you’d want to do this is to merge specific changes you need now, leaving other code changes you’re not interested in right now behind.
First of all, use git log or the awesome GitX tool to see exactly which commit you want to pick. An example:
dd2e86 - 946992 - 9143a9 - a6fd86 - 5a6057 [master]
\
76cada - 62ecb3 - b886a0 [feature]
alias gs='git status'
alias gco='git checkout'
alias gc='git commit'
alias grb='git rebase'
alias gb='git branch'
alias ga='git add -A'
alias gpl='git pull'
alias gp='git push'
alias glg='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
alias glg2='git log --date-order --all --graph --name-status --format="%C(green)%H%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'