Skip to content

Instantly share code, notes, and snippets.

@STRd6
STRd6 / manifest_generator.rb
Created March 21, 2012 03:52
Generate that hmtl5 manifest crap. I just copied this from somewhur.
#!/usr/bin/env ruby
# Set the local path to loop through
# Relative paths are fine. End with a slash.
PATH = "./"
# Set the file types to look for
FILE_TYPES = "css,jpg,png,html,js,svg,ttf,woff"
IGNORE_FILES = [""]
@STRd6
STRd6 / s3backup.rake
Created May 26, 2011 03:18
Backup you db to s3, brah.
namespace :backup do
task :database do
AWS::S3::Base.establish_connection!(
:access_key_id => '123',
:secret_access_key => '456'
)
database = "pixie_production"
file = 'dump.sql'
`pg_dump #{database} -U postgres > #{file}`
@STRd6
STRd6 / Super Ultimate JavaScript ORM
Created April 15, 2011 05:25
It is even more ultimate.
Object.extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
};
Object.reverseMerge = function(destination, source) {
for (var key in source) {
@STRd6
STRd6 / detect_idle.coffee
Created April 14, 2011 06:17
Detect when user is idle from mouse movement
#TODO: Fade out things under certain conditions
lastMoved = new Date().getTime()
inactiveThreshold = 2000
$(document).bind "mousemove", ->
lastMoved = new Date().getTime()
setInterval ->
currentTime = new Date().getTime()
inactiveTime = currentTime - lastMoved
/**
* Matrix v0.9.0
*
* Loosely based on flash:
* http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/geom/Matrix.html
*/
(function() {
function Point(x, y) {
return {
x: x || 0,
@STRd6
STRd6 / nginx.conf
Created May 6, 2010 20:48
nginx.conf
user www-data www-data;
worker_processes 3;
error_log /opt/nginx/logs/error.log;
events {
worker_connections 1024;
}
http {