Skip to content

Instantly share code, notes, and snippets.

@zaus
zaus / commands.bash
Last active December 12, 2015 06:59
Common GIT commands for different scenarios?
# clone repository to current working directory (cwd)
git clone "{{repo}}" .
# clone a repository to the current directory, "symlinking" git files elsewhere, checking out single file
git clone -n --separate-git-dir="{{extpath}}\{{ProjectName}}" "{{path}}\{{ProjectName}}" .
git checkout HEAD {{file}}
## Explanation:
## 1. git
## clone
## -n no files checked out, just history; could use `--bare` as well?
@zaus
zaus / jquery.tinierpubsub.js
Last active December 12, 2015 10:08 — forked from cowboy/HEY-YOU.md
/* jQuery Tinier Pub/Sub - v0.9 - 2013-02-11
* original by http://benalman.com/ 10/27/2011
* Original Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
// "topic" holder
var o = $({}); // use $('<b>') with Zepto, as it doesn't like {} ?
// attach each alias method
@zaus
zaus / OtherRAFShims.js
Last active December 14, 2015 13:19 — forked from mrdoob/RequestAnimationFrame.js
Exploring simpler `requestAnimationFrame` shims
// simplest, "original": 234 char
!window.requestAnimationFrame && (window.requestAnimationFrame = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60) });
// compressible simplest: 157 char
(function(w,anif) {
if(!w['r' + anif]) w['r' + anif] = w['webkitR' + anif] || w['mozR' + anif] || w['msR' + anif] || w['oR' + anif] || function (callback) { w.setTimeout(callback, 1000 / 60) };
})(window, 'equestAnimationFrame');
@zaus
zaus / index.haml
Created March 12, 2013 16:27
A CodePen by Jorge Epuñan. CSS3 text-shadow effects
%h1.elegantshadow Elegant Shadow
%h1.deepshadow Deep Shadow
%h1.insetshadow Inset Shadow
%h1.retroshadow Retro Shadow
@zaus
zaus / _breakpoint.scss
Last active December 14, 2015 22:58
lesjames/Breakpoint minimal install
// needs some kind of reset?
body { padding:0px; margin:0px; }
@import "compass-includes";
@import "grid-helpers";
@import "grid-core";
// USAGE
// ============
@zaus
zaus / parse-hash-bang-arguments-in-javascript.js
Last active December 15, 2015 04:29 — forked from miohtama/parse-hash-bang-arguments-in-javascript.js
Parse "hashbang" `#!` arguments like url query-string. [original source](https://gist.github.com/miohtama/1570295)
/**
* Parse hash bang parameters from a URL as key value object.
* For repeated parameters the last parameter is effective.
* If = syntax is not used the value is set to null.
* #!x&y=3 -> { x:null, y:3 }
* @param url URL to parse or null if window.location is used
* @return Object of key -> value mappings.
* @source https://gist.github.com/zaus/5201739
*/
function hashbang(url, i, hash) {
@zaus
zaus / jquery.removeClassWhere.js
Created March 22, 2013 13:30
The missing jQuery function to easily remove classes matching a filter -- combines `$el.removeClass` and `$.grep`.
$.fn.removeClassWhere = function (filter) {
/// <summary>
/// Remove classes matching a filter fn(class, index_in_list) -- combines .removeClass and .grep
/// <example>$('.things').removeClassWhere(function (cl) { return -1 != cl.indexOf(matches); });</example>
/// </summary>
return $(this).removeClass(function (i, classes) {
return $.grep(classes.split(' '), filter).join(' ');
});
};//-- fn removeClassWhere
@zaus
zaus / index.html
Created June 20, 2013 13:12
Nice complementary colors. A #CodePen by JB Price.
<div class="box red"></div>
<div class="box orange"></div>
<div class="box yellow"></div>
<div class="box green"></div>
<div class="box teal"></div>
<div class="box blue"></div>
<div class="box purple"></div>
<div class="box pink"></div>
@zaus
zaus / text-input-love.html
Last active December 20, 2015 20:49
A CodePen by Michael Arestad. Text input love - I wanted to play with some input styles that don't rely on hover, don't add clutter, show the label at all times, and show placeholder text when it is actually relevant.
<div class="row">
<p>Click every input.</p>
</div>
<div class="row">
<span>
<input class="basic-slide" id="name" type="text" placeholder="Your best name" /><label for="name">Name</label>
</span>
<span>
<input class="basic-slide" id="email" type="text" placeholder="Your favorite email" /><label for="email">Email</label>
</span>
@zaus
zaus / DelayedRenderExtensions.cs
Created September 27, 2013 18:06
RenderSections in PartialViews -- delayed rendering of any HTML content. See SO answer: http://stackoverflow.com/a/18790222/1037948
public static class HtmlRenderExtensions {
/// <summary>
/// Delegate script/resource/etc injection until the end of the page
/// <para>@via http://stackoverflow.com/a/14127332/1037948 and http://jadnb.wordpress.com/2011/02/16/rendering-scripts-from-partial-views-at-the-end-in-mvc/ </para>
/// </summary>
private class DelayedInjectionBlock : IDisposable {
/// <summary>
/// Unique internal storage key
/// </summary>