Skip to content

Instantly share code, notes, and snippets.

{
"event": {
"event_type": "signature_request_viewed",
"event_time": "1562151155",
"event_hash": "0fa0674d805a5c097d00a30b9d594f24b4e578a56fb372a7111cf34afaa9aaf2",
"event_metadata": {
"related_signature_id": "ab61c835f738ccaf8e2e10f85b241264",
"reported_for_account_id": "5aacd6442d98dde98bb76b82bf6fa3f73c87451d",
"reported_for_app_id": null
}
@b051
b051 / ilabs4cn.py
Last active November 30, 2018 08:38
#!/usr/bin/env python2
# coding=utf-8
import json
import logging
import time
import select
import paramiko
import random
from aliyunsdkcore.client import AcsClient
@b051
b051 / auto_rest.py
Last active September 6, 2017 09:03
#!/usr/bin/env python2
import sys
import time
import thread
import struct
from Quartz.CoreGraphics import *
kVK_ANSI_1 = int('12', 16)
kVK_ANSI_2 = int('13', 16)
@b051
b051 / readme.md
Last active August 29, 2015 14:22
API Usage
let parameters = [
  "customer": ["id": "1459504", "email": "steve@interactivelabs.co"],
  "campaign": ["id": 14190]
]
loadingView.startLoading()
Client.request(.POST, "/referral_codes", parameters) {(result, error) in
  if let result = result {
    let userDefaults = NSUserDefaults.standardUserDefaults()
    if let referralCode = result["referral_code"] as? String {
@b051
b051 / test.py
Last active August 29, 2015 14:10
o = range(100)
def atob(i):
if i < pattern[0]:
return i
c, m = divmod(i - pattern[0], pattern[1])
if m >= 0:
c += 1
c = min(len(x), c)
return i + c
@b051
b051 / gist:14869ded8ec155b4bd5a
Created October 28, 2014 04:12
location test
geolib = require 'geolib'
sf_94118 = latitude: 37.789018, longitude: -122.391506
places = [
{name: 'Bayview Parents', latitude: 37.7304153, longitude: -122.3844223},
{name: 'Bernal Heights Parents', latitude: 37.7485809, longitude: -122.4184113},
{name: 'Cole Valley Parents', latitude: 37.7717171, longitude: -122.4438934},
{name: 'Excelsior_Parents', latitude: 37.7225494, longitude: -122.4410629},
{name: 'Glen Park Parents (old group)', latitude: 37.7401047, longitude: -122.4382324},
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Net;
using System.Linq;
public class PublishAmazonSnsMsg
{
@b051
b051 / gist:b337e0157c663a9988f3
Created August 8, 2014 09:53
batch change timezone
tell application "iPhoto"
set curPhotos to selection
repeat with thisPhoto in curPhotos
set thisDate to (date of thisPhoto)
set hours to (thisDate's hours) - 15
if hours < 0 then
set hours to hours + 24
set thisDate's day to (thisDate's day) - 1
end if
sameBirthdayPossibility = (N) ->
x = 1
[0...N].forEach (n) -> x *= 1 - n / 365
1 - x
console.log sameBirthdayPossibility 43

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";