Skip to content

Instantly share code, notes, and snippets.

View mave99a's full-sized avatar
:octocat:
I may be slow to respond.

Robert Mao mave99a

:octocat:
I may be slow to respond.
View GitHub Profile
pragma solidity ^0.4.0;
import "SafeMath.sol";
import "IERC20Token.sol";
/**
* @dev Implements a capped token sale using a second-price auction.
*
* @author Nick Johnson <arachnid@notdot.net>
*
@dweldon
dweldon / meteor-nginx
Last active January 22, 2024 06:53
This is an example of how to configure nginx to serve a meteor app.
server {
listen [::]:80;
listen 80;
server_name app.example.com;
return 301 https://$server_name$request_uri;
}
server {
@mayoff
mayoff / makeAnimatedGif.m
Created February 16, 2013 23:00
Example of creating an animated GIF on iOS, with no 3rd-party code required. This should also be easy to port to OS X.
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@dhui
dhui / resources.py
Created April 23, 2012 01:46
Tastypie Hierarchical Resource
from tastypie.fields import ToOneField
from resources_base import CustomModelResource, ChildResource
from models import User, Post
class UserResource(CustomModelResource):
class Meta:
@chrishulbert
chrishulbert / DictionaryTypesHelper.m
Created November 30, 2011 02:49
Dictionary Types Helper
// DictionaryTypesHelper.h
#import <Foundation/Foundation.h>
@interface NSDictionary (NSDictionary_DictionaryTypesHelper)
- (NSArray*)arrayForKey:(id)key;
- (NSDictionary*)dictionaryForKey:(id)key;
- (NSString*)stringForKey:(id)key;
- (NSNumber*)numberForKey:(id)key;
- (NSData*)dataForKey:(id)key;
@zyegfryed
zyegfryed / gist:814432
Created February 7, 2011 14:25
Tastypie OAuth
from oauth2 import Error
from django.utils.translation import ugettext as _
from tastypie.authentication import Authentication
from oauth_provider.utils import initialize_server_request, send_oauth_error, get_oauth_request
from oauth_provider.consts import OAUTH_PARAMETERS_NAMES
from oauth_provider.store import store, InvalidTokenError
@debrouwere
debrouwere / gist:809993
Created February 3, 2011 19:20
Nested resources in django-tastypie
from sandbox import models
from tastypie import fields
from apibase.resources import CamayakModelResource
from django.conf.urls.defaults import url
class ModelResource(CamayakModelResource):
def override_urls(self):
urls = []
for name, field in self.fields.items():
@creationix
creationix / chatServer.js
Created November 19, 2010 20:47
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
@wmerrifield
wmerrifield / build+archive.sh
Created November 8, 2010 17:53
A shell script to perform the equivalent of Xcode's "Build & Archive" command.
#!/bin/sh
#
# Copyright (c) 2010 Warren Merrifield
#
# 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:
@0atman
0atman / post-receive
Created October 25, 2010 15:37
Simple git hook to auto deploy a django app to an 'unstable' testing server.
#!/bin/sh
#
# An example hook script that is called after a successful
# commit is made.
#
# To enable this hook, make this file executable.
echo "Starting auto-deploy..."
cd /usr/share/django