Skip to content

Instantly share code, notes, and snippets.

@coderarity
coderarity / foo.js
Last active December 14, 2015 21:09 — forked from zeromodulus/foo.js
// (c) 2013 coderarity is a boss, inc
function Foo (id) {
var _this = this;
if (id) {
db.redis.get(id, function(err, res) {
var obj = JSON.parse(res);
for (property in obj) {
if (property === 'date_created') {
_this[property] = new Date(obj[property]);
} else {
@coderarity
coderarity / gist:5085896
Created March 4, 2013 21:37
this is a messy way to find a git file from the depths of git! change the grep to be some way to identify your file
git prune -n > tmp12312661.txt
sed -i 's/ blob//g' tmp12312661.txt
while read line
do
git cat-file -p $line | grep "require('simplesmtp')"
if [ "$?" == "0" ]; then echo $line; fi
done < tmp12312661.txt
rm tmp12312661.txt
@coderarity
coderarity / gist:4617985
Created January 24, 2013 05:45
what's wrong with this?
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#define ERROR_VAL -1
#define SUCCESS_VAL 0
#define ERROR (err) { errno = (err); }
var express = require('express'),
wine = require('./routes/wines');
var app = express();
app.configure(function () {
app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */
app.use(express.bodyParser());
app.use(express.static(__dirname));
});
@coderarity
coderarity / gist:4425929
Created January 1, 2013 08:33
Awesome lack of Java on android! I am pleased.
// from http://android-developers.blogspot.com/2011/01/gingerbread-ndk-awesomeness.html
void android_main(struct android_app* state) {
// Make sure glue isn't stripped.
app_dummy();
// loop waiting for stuff to do.
while (1) {
// Read all pending events.
int ident;
@coderarity
coderarity / gist:4409172
Created December 29, 2012 20:25
mtpfs crashes with Nexus 7 after trying to copy some books over
Dec 29 15:21:31 twilight sudo[1324]: coderarity : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/bin/mtpfs -o allow_other /media/Nexus7/
Dec 29 15:21:31 twilight sudo[1324]: pam_unix(sudo:session): session opened for user root by coderarity(uid=0)
Dec 29 15:21:40 twilight sudo[1324]: pam_unix(sudo:session): session closed for user root
Dec 29 15:22:11 twilight kernel: mtpfs[1330]: segfault at 0 ip 0804c9b1 sp b68fefe0 error 4 in mtpfs[8048000+7000]
Dec 29 15:22:11 twilight systemd-coredump[1373]: Process 1328 (mtpfs) dumped core.
@coderarity
coderarity / gist:4394690
Created December 28, 2012 05:01
simple example of how to update Nodejitsu domains field without adding it to your package.json
var http = require('http')
var nj = require('nodejitsu-api')
var client = nj.createClient({
username: 'coderarity',
password: '*****',
remoteUri: 'https://api.nodejitsu.com'
})
var appname = 'dns-test'
@coderarity
coderarity / gist:4361459
Created December 22, 2012 22:06
Tower of Heaven level - play at https://www.newgrounds.com/portal/view/544332 click load custom level
1c0c100001080100000000000000000004021e0602110702110802110902120a02120b02110c02110303030403030503030603030703030803030903030a03030b03030c03030404080504080604080704080804080904080a04080b04080c04080f05060408070c08071108050409030c0903000a1d010a07110a07000b03010b03080b05090b05100b03110b03|jaws|coderarity||
@coderarity
coderarity / curlPass
Created December 5, 2012 06:16 — forked from whyink/curlPass
curlPass
ofshard@whyink:~/346321 (master) $ curl -X POST \ -H "Content-type: application/json" \ --data "{ \"credentials\": githubUser:githubPassword }" \ https://nodejitsuUse
r:nodejitsuPass@webhooks.nodejitsu.com/1/auth/github
curl: (6) Couldn't resolve host ' -H'
{
"name": "nko3-intergrupo-mobile",
"version": "0.0.0-6",
"description": "Intergrupo Mobile",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"repository": {
"type": "git",