Skip to content

Instantly share code, notes, and snippets.

View STRd6's full-sized avatar
🍑
https://whimsy.space

Daniel X Moore STRd6

🍑
https://whimsy.space
View GitHub Profile
@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 {
/**
* 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 / 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
@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 / 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 / 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 / gist:2288230
Created April 3, 2012 00:23
Mysterious array allocation
(gdb) break XModule.cpp:1882
Breakpoint 1 at 0x407d84: file XModule.cpp, line 1882. (2 locations)
(gdb) run
Starting program: /home/daniel/Desktop/milkytracker-0.90.85/src/milkyplay/extractor
Breakpoint 1, XModule (this=0x76c670) at XModule.cpp:1882
1882 phead = new TXMPattern[256];
(gdb) print phead
$1 = (TXMPattern *) 0x0
(gdb) print header
#include "Extractor.h"
#include "XModule.h"
#include <iostream>
using namespace std;
int main ()
{
XModule* module = new XModule();
SYSCHAR* fileName = "Greensleeves.xm";
@STRd6
STRd6 / gist:2647338
Created May 9, 2012 17:56 — forked from bluefuton/gist:1468061
OS X: replace tabs with spaces in all files using expand
find . -name "*.[hm]" | while read line; do expand -t 2 "$line" > "$line.new"; mv "$line.new" "$line"; sed -i "" 's/ *$//' "$line"; done
findCondenseOrCreate = (normalizedTag, name, fn) ->
query = new Parse.Query("Category")
query.equalTo "normalizedTag", normalizedTag
query.find
success: (results) ->
[category, duplicates...] = results
# We could try and collect numbers, but we really
# don't care since we should be recounting anyway