Skip to content

Instantly share code, notes, and snippets.

View bjrn's full-sized avatar

Björn Rixman bjrn

View GitHub Profile
@melanke
melanke / MultiGetSet.js
Created June 19, 2012 20:53
MultiGetSet.JS - Quickly generate getters and setters for multiple attributes
var MultiGetSet = function(opt){
var getType = function(o) {
return ({}).toString.call(o).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
};
if(!opt.public || !opt.private)
return opt.public;
if(opt.handler && opt.handler.init)
@chriscoyier
chriscoyier / dabblet.css
Created January 24, 2012 03:09
Animate to natural width
/* Animate to natural width */
body { background: black; padding: 100px; margin: 0; }
.progress-bar {
border: 2px solid red;
border-radius: 14px;
}
.progress-bar > div {
@trevorgerzen
trevorgerzen / dabblet.css
Created January 10, 2012 17:47 — forked from chriscoyier/dabblet.css
YouTube Footer Buttons
/*
YouTube Footer Buttons
*/
.button {
border: 1px solid #DDD;
border-radius: 3px;
text-shadow: 0 1px 1px white;
box-shadow: 0 1px 1px #fff;
font: bold 11px Sans-Serif;
@mattsahr
mattsahr / native.scroll.html
Created November 17, 2011 02:47
IOS Webkit - native internal scroll - a fix for the document page-top-bounce
<!DOCTYPE html>
<html>
<!-- NOTES
Demo - uses IOS native scroll available in IOS5, but sidestep the document-bounce behavior. Tested on iPad 1, using IOS 5.1.
This approach uses a set of 3 nested divs.
OuterDiv -- fixed height, width, overflow-scrolling: touch;
MiddleDiv -- fixed height width, overflow-scrolling: touch; fits inside OuterDiv
InnerDiv -- fixed height width, bigger than MiddleDiv, so it kicks in the overflow behavior
@tvandervossen
tvandervossen / gist:1231476
Created September 21, 2011 07:33
Mobile Safari viewport sizes on iOS 4.3 and 5
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@eklimcz-zz
eklimcz-zz / javascript scoller
Created July 25, 2011 16:36
iOS Fixed Position Scroller with Ease
/*-----------------------------------------
Usage
var list = document.getElementById('dataList'); //Any Div with Items in it
Scroller.init(list, 'x', _hasTouch); //'x' or 'y'
-----------------------------------------------*/
var Scroller = new
function() {
//Public Properties
@madrobby
madrobby / delayed_hover.js
Created July 5, 2011 19:45
Little Zepto "delayed hover" plugin, using this with backbone.js events
// (c) 2011 Thomas Fuchs
(function($){
$.fn.delayedHover = function(){
var timeout = null, hovering = false, element = this;
function enter(){
element.trigger('delayed_hover:enter');
timeout = null;
hovering = true;
@kirbysayshi
kirbysayshi / README.markdown
Created June 13, 2011 04:40
quick nodejs script to combine, possibly minify, scripts, as well as precompile templates:

This is a quick example of taking a config file (example.js), and running jscombine.js. It will bundle up regular scripts as well as templates (hard coded to use doT). Compiled templates are automatically added to a "templates" property on the given namespace (ns key in the example file), keyed by a slightly transformed version of their filename.