Skip to content

Instantly share code, notes, and snippets.

@evanlong
evanlong / k03.js
Created November 4, 2011 07:56
plane test
navigator.getcurrentposition(function(p){console.info(o)})
@evanlong
evanlong / main.py
Created November 29, 2011 04:26
twitter image fetcher
#!/usr/bin/env python
""" Sample calls:
http://twimgproxy.appspot.com/image?screen_name=evanlong
http://twimgproxy.appspot.com/image?user_id=20
"""
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api.urlfetch import fetch
@evanlong
evanlong / info.evanlong.apps.sandbox.plist
Last active February 4, 2016 03:18
poor man's cloud.app
<!-- This file goes in ~/Library/LaunchAgents -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>KeepAlive</key>
<true/>
@evanlong
evanlong / thecrash.log
Created December 19, 2011 23:56
remote gdb messed up on a device
0 libsystem_kernel.dylib mach_msg_trap (in libsystem_kernel.dylib) + 20
1 libsystem_kernel.dylib mach_msg (in libsystem_kernel.dylib) + 50
2 libxpc.dylib _xpc_connection_check_in (in libxpc.dylib) + 152
3 libxpc.dylib _xpc_connection_init (in libxpc.dylib) + 1032
4 libxpc.dylib _xpc_connection_wakeup2 (in libxpc.dylib) + 774
5 libxpc.dylib _xpc_connection_wakeup (in libxpc.dylib) + 62
6 libxpc.dylib _xpc_connection_send_registration (in libxpc.dylib) + 24
#If you are reading this... reboot your iOS device. Your problems will probably go away.
@evanlong
evanlong / BeerLicense.txt
Created December 23, 2011 06:23
An Improved MIT License. More Beer.
Copyright (C) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@evanlong
evanlong / LWHangDetector.h
Last active November 17, 2016 16:06
Simple Hang Detection
/**
Copyright (C) 2011 Evan Long
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
@evanlong
evanlong / prettycolor.m
Created January 1, 2012 12:04
For Leafo
/*
See screenshot: http://cl.ly/1v1H0Q1z0Z3R0z3X1R25
*/
- (void)loadView {
self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
CGFloat width = self.view.frame.size.width;
@evanlong
evanlong / capture.py
Created January 3, 2012 04:10
dump stack info along with locals
import sys
def foo(n):
a = "Hello"
b = "bob"
c = 1 / n
return a + " " + b
@evanlong
evanlong / scoperelease.txt
Created January 11, 2012 01:53
Intead of ARC
Instead of ARC:
Add scoperelease in addition to release and autorelease.
Think of it like scoped_ptr in C++ or more generally how deconstructors
get called for stack allocated objects (end of scope).
- (id)someMethod:(NSInteger)n {
MyObject *o = [[[MyObject alloc] init] scoperelease];
@evanlong
evanlong / test_linux.c
Created January 25, 2012 06:39
C Program to print current directories filesnames and lengths
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
int main(int argc, char** argv) {
DIR *d = opendir(".");
struct dirent *entry = NULL;