Skip to content

Instantly share code, notes, and snippets.

@jasonwyatt
jasonwyatt / polylinefade.js
Created November 18, 2010 17:13
Fade out a google maps polyline.
function fadeOut(line, keepAround, fadeDuration){
keepAround = keepAround || 1000;
fadeDuration = fadeDuration || 500;
setTimeout(function(){
var startingOpacity = line.strokeOpacity,
startTime = (new Date()).getTime();
function step(){
var currentTime = (new Date()).getTime(),
@joelambert
joelambert / README
Created June 1, 2011 11:03
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@cowboy
cowboy / ba-backbone-module.js
Created September 9, 2011 18:05
Idea for a Backbone module system (allowing modules to be accessed across multiple files, possibly loaded out of order). Inspired by https://gist.github.com/1202511
/*!
* Backbone Module Manager - v0.1pre - 9/9/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
function ModuleManager(fn) {
@potfur
potfur / $.js
Last active February 15, 2023 14:49
window.S = function(s) {
return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName'}[s[0]]
|| 'querySelectorAll'](s.slice(1))
};
// [S('#header'), S('.container'), S('?div')]
@bellbind
bellbind / fire.html
Last active June 8, 2016 10:06
[javascript][html5]replacement of setInterval(frame, framems) with requestAnimationFrame(callback(now))
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<script src="fire.js"></script>
</head>
<body>
<canvas id="canvas" width="300" height="300" style="background-color: white"
></canvas>
</body>
@magnetikonline
magnetikonline / README.md
Last active April 30, 2024 00:45
Setting Nginx FastCGI response buffer sizes.
@doersino
doersino / backup_tumblr.sh
Last active January 15, 2022 23:32
Simple way of backing up one or multiple Tumblr blogs to date-prefixed folders; downloads and removes required software (except Python) automatically. http://neondust.tumblr.com/post/97723922505/simple-tumblr-backup-script-for-mac-os-x-and-linux
#!/bin/bash
# http://neondust.tumblr.com/post/97723922505/simple-tumblr-backup-script-for-mac-os-x-and-linux
# https://gist.github.com/doersino/7e3e5db591e42bf543e1
# BLOGS is a space-separated list of the blogs you want to backup. You can omit
# the ".tumblr.com" part if you want.
BLOGS="neondust.tumblr.com aufgeloest.tumblr.com hejlisten.tumblr.com"
# OUT is the directory where the backups will be stored. For each blog, a date-
# prefixed subdirectory will be created here.
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@seancoyne
seancoyne / fix-google-drive-menu-bar-icons.sh
Created October 21, 2014 15:34
Fix Google Drive Yosemite Dark Mode Menu Bar Icons
#!/usr/bin/env bash
# change to proper directory
cd /Applications/Google\ Drive.app/Contents/Resources/
# back up the files
sudo mkdir icon-backups
sudo cp mac-animate*.png icon-backups/
sudo cp mac-error*.png icon-backups/
sudo cp mac-inactive*.png icon-backups/
@techslides
techslides / wp-ajax-upload.php
Last active November 26, 2020 14:15
Upload to WordPress with Ajax and FormData
<input type="file" name="file" id="file">
<input type="submit" id="submit" name="Upload" onclick="upload();return false;">
<script type="text/javascript">
function upload(){
var formData = new FormData();
formData.append("action", "upload-attachment");
var fileInputElement = document.getElementById("file");
formData.append("async-upload", fileInputElement.files[0]);