Skip to content

Instantly share code, notes, and snippets.

🕶

Amadeus Demarzi amadeus

🕶
Block or report user

Report or block amadeus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@amadeus
amadeus / gist:845696
Created Feb 26, 2011
JS Prefix Tests
View gist:845696
var prefix = (function(){
var list = ['', 'webkit', 'Moz', 'O', 'ms'],
element = document.html;
for (var i = 0; i < list.length; i++){
var prefix = list[i];
if (element.style[prefix ? prefix + 'Transform' : 'transform'] != null)
return prefix.toLowerCase();
}
return '';
@amadeus
amadeus / gist:983364
Created May 20, 2011
Penner's easing methods in CSS
View gist:983364
'linear:in': cubic-bezier(0,0,1,1)
'linear:out': cubic-bezier(0,0,1,1)
'linear:in:out': cubic-bezier(0,0,1,1)
'expo:in': cubic-bezier(0.71,0.01,0.83,0)
'expo:out': cubic-bezier(0.14,1,0.32,0.99)
'expo:in:out': cubic-bezier(0.85,0,0.15,1)
'circ:in': cubic-bezier(0.34,0,0.96,0.23)
'circ:out': cubic-bezier(0,0.5,0.37,0.98)
'circ:in:out': cubic-bezier(0.88,0.1,0.12,0.9)
'sine:in': cubic-bezier(0.22,0.04,0.36,0)
@amadeus
amadeus / SimpleJSONDecoder.js
Created Sep 29, 2011
A simple way to parse JSON.
View SimpleJSONDecoder.js
(function(){
if (!this.JSON) this.JSON = {};
var decode = window.JSON.parse || function(str){
return window.eval('(' + str + ')');
};
this.JSON.decode = function(str){
var json = null;
try {
@amadeus
amadeus / server.py
Created May 17, 2012
A simple static asset python server
View server.py
import SimpleHTTPServer
import SocketServer
PORT = 8888
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print 'Serving at localhost:' + str(PORT)
httpd.serve_forever()
@amadeus
amadeus / clone.js
Created Jul 26, 2012
A nice and simple clone function.
View clone.js
var clone = function clone(src) {
var r, i, l,
mixin = function(dest, source, copyFunc) {
var name, s, i, empty = {};
for(name in source){
s = source[name];
if(!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))){
dest[name] = copyFunc ? copyFunc(s) : s;
}
}
@amadeus
amadeus / gist:3420258
Created Aug 21, 2012
Ghetto Slideshow
View gist:3420258
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Slideshow</title>
<style type="text/css">
html, body { margin:0; padding:0; }
img { display:block; margin:0 auto; }
</style>
</head>
@amadeus
amadeus / backingStoreNotes.md
Created Sep 13, 2012
Notes on context.webkitBackingStorePixelRatio
View backingStoreNotes.md

Notes on context.webkitBackingStorePixelRatio

Basically the intended use for this new API is the following.

You have your canvas as is, forget the world of retina displays, just think of CSS units, not physical pixels. Physical pixels have now been abstracted away.

You create your canvas in your document, you set your canvas to be 940px wide since your website is on a 940 pixel grid (for example).

You begin drawing to your canvas, and everything just works. You get high resolution lines, high resolution circles, shapes, etc. The canvas, while you interact with it in a lower resolution, is automagically upscaled internally for you, as if you where drawing vectors.

View .jslintrc
#
# Configuration File for JavaScript Lint 0.3.0
# Developed by Matthias Miller (http://www.JavaScriptLint.com)
#
# This configuration file can be used to lint a collection of scripts, or to enable
# or disable warnings for scripts that are linted via the command line.
#
### Warnings
# Enable or disable warnings based on requirements.
View vimrc.vim
" TESTING: Entity Escaper
command Entities :call Entities()
function Entities()
silent %s/&/\&amp;/eg
silent %s/"/\&quot;/eg
silent %s/'/\&apos;/eg
silent %s/</\&lt;/eg
silent %s/>/\&gt;/eg
silent %s/¡/\&iexcl;/eg
silent %s/¢/\&cent;/eg
@amadeus
amadeus / buffdelete.vim
Created Nov 8, 2012
CtrlP Buffer Delete
View buffdelete.vim
" TESTING: CtrlPBuf Delete
let g:ctrlp_buffer_func = { 'enter': 'MyCtrlPMappings' }
func! MyCtrlPMappings()
nnoremap <buffer> <silent> <c-@> :call <sid>DeleteBuffer()<cr>
endfunc
func! s:DeleteBuffer()
exec "bd" fnamemodify(getline('.')[2:], ':p')
exec "norm \<F5>"
You can’t perform that action at this time.