Skip to content

Instantly share code, notes, and snippets.

@joshj
joshj / server.js
Created February 28, 2012 16:58 — forked from jeffrafter/server.js
Twitter OAuth with node-oauth for node.js+express
/*
Node.js, express, oauth example using Twitters API
Install Node.js:
curl -0 http://nodejs.org/dist/v0.6.11/node-v0.6.11.tar.gz
tar -zxf node-v0.6.11.tar.gz
cd node-v0.6.11
./configure
make
make install
@tuncbahcecioglu
tuncbahcecioglu / auth_twitter_login.js
Created December 14, 2012 23:13
node.js oauth example: logins to twitter, displays user name
// https://gist.github.com/1964797
var express = require('express');
var sys = require('util');
var oauth = require('oauth');
var app = express();
var _twitterConsumerKey = 'sLNC1nUodJom3L8BNL4iHA';
var _twitterConsumerSecret = 'EcO8Iiv5M8R0qeLVbHAi2cm9uX4Fp1jPODnoGfqUEro';
@yoggy
yoggy / uuid_test.c
Created January 8, 2013 11:19
libuuid sample program
//
// libuuid sample program
//
// library install for debian
// $ sudo apt-get install uuid-dev
//
// compile
// $ gcc uuid_test.c -luuid -o uuid_test
//
#include <stdio.h>
@berzniz
berzniz / NSObject+Debounce.h
Created January 25, 2014 16:18
Debounce method for Objective C
@interface NSObject (Debounce)
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay;
@end
@JadenGeller
JadenGeller / Swift Atomic Operators.swift
Created March 17, 2015 01:38
Swift Atomic Operators
import Foundation
infix operator +=! { associativity right precedence 90 } // Int32 or Int64
infix operator -=! { associativity right precedence 90 } // Int32 or Int64
postfix operator ++! {} // Int32 or Int64
postfix operator --! {} // Int32 or Int64
infix operator |=! { associativity right precedence 90 } // UInt32
infix operator &=! { associativity right precedence 90 } // UInt32
@Koze
Koze / PhotosCameraRoll.m
Last active February 3, 2018 06:26
Getting Camera Roll with Photos.framework
PHFetchResult *result = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum
subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary
options:nil];
PHAssetCollection *assetCollection = result.firstObject;
NSLog(@"%@", assetCollection.localizedTitle);
// Camera Roll
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
@chriseth
chriseth / 0 README.md
Last active November 6, 2022 19:55
Formal verification for re-entrant Solidity contracts

This gist shows how formal conditions of Solidity smart contracts can be automatically verified even in the presence of potential re-entrant calls from other contracts.

Solidity already supports formal verification of some contracts that do not make calls to other contracts. This of course excludes any contract that transfers Ether or tokens.

The Solidity contract below models a crude crowdfunding contract that can hold Ether and some person can withdraw Ether according to their shares. It is missing the actual access control, but the point that wants to be made

@simme
simme / debounce-throttle.swift
Created December 20, 2016 10:04
Swift 3 debounce & throttle
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would