Skip to content

Instantly share code, notes, and snippets.

View PaulCapestany's full-sized avatar

Paul Capestany PaulCapestany

View GitHub Profile
@pulkitsinghal
pulkitsinghal / couchcocoa.patch
Created February 3, 2013 14:45
Out-of-box document-level do not delete support for table rows
diff --git a/UI/iOS/CouchUITableSource.h b/UI/iOS/CouchUITableSource.h
index c335c99..3f08d1e 100644
--- a/UI/iOS/CouchUITableSource.h
+++ b/UI/iOS/CouchUITableSource.h
@@ -45,6 +45,13 @@
#pragma mark Editing The Table:
+/**
+ * If non-nil, specifies the property name of the query row's value that will be used

Most developers that are familiar with dynamic scripting language like Ruby, JavaScript, or Python have been exposed to higher-order functions. Coming from a scripting background, it can be hard to translate that knowledge into Go, since the type system seems to get in the way. On the other hand, coming from a statically typed, primarily object-oriented language like C++, C#, or Java, the problem may be the opposite: static type systems are less of a stumbling block, but the usage of higher-order functions may be less intuitive. For programmers with functional experience, most of this knowledge may come across as very pedestrian, but hopefully this article will at least demonstrate how to use Go's type system with respect to functions.

In this article, we'll look at a few situations where function types in Go can be very useful. The reader is not assumed to be an experienced Go programmer, although a cursory knowledge of Go will certainly be helpful

./sync_gateway ~/code/CouchChat-iOS/sync-gateway-config.json
16:23:39.792740 Enabling logging: [CRUD REST+]
Sync Gateway starting with config settings:
{
"Interface": ":4984",
"AdminInterface": ":4985",
"Persona": {
"Origin": "http://animal.local:4984/"
},
"Log": [
@nriley
nriley / extract.py
Created June 27, 2013 06:51
Extract English subtitle text for WWDC 2013 videos.
import requests
import os, re, sys
RE_SD_VIDEO = re.compile(
r'<a href="(http://devstreaming.apple.com/videos/wwdc/2013/[^"]*-SD.mov)')
RE_WEBVTT = re.compile(r'fileSequence[0-9]+\.webvtt')
# stdin: dump of https://developer.apple.com/wwdc/videos/
for l in sys.stdin:
m = RE_SD_VIDEO.search(l)
@dustin
dustin / progress.go
Last active December 19, 2015 16:18
Uploading a ton of stuff to S3, I decided I wanted something that would take this boring *os.File and give me a progress indicator. Here's the thing I threw together. Sends this sort of thing to stdout ('\r'ing over itself every second): 10MB/72MB (14.6%)
package main
import (
"fmt"
"io"
"os"
"time"
"github.com/dustin/go-humanize"
)
@aantonop
aantonop / gist:7787199
Created December 4, 2013 13:11
A script to find bitcoin addresses in Twitter @mentions (replies) responding to my offer to donate bitcoin.
import tweepy
import time
import re
import pycoin.encoding
import pickle
# Removed security tokens from gist, replaced with XXX.
auth = tweepy.OAuthHandler("XXX", "XXX")
auth.set_access_token('XXX', 'XXX')
@FlamingTempura
FlamingTempura / gist:a3b71e69c6d81852c1ab
Created March 14, 2015 18:21
Archive wordpress to html using wget
wget -m -np -a example.com_$(date +%Y%m%d).log -e robots=off -nv --adjust-extension --convert-links --page-requisites http://example.com
@ttscoff
ttscoff / cliptextfile.sh
Created January 15, 2013 15:12
Copy the contents of any text file to the clipboard, intended for use as an OS X System Service
# A stupid script that actually makes a handy system service
# Use it to right click files and extract their text content to the clipboard
# Brett Terpstra 2013, no rights reserved
txtcount=`file "$@"|grep -c text`
response=0
msg=""
if [ $txtcount -eq $# ]; then
cat "$@"|pbcopy
if [ "$?" -ne "0" ]; then
msg="Error running command"
@BlinkyStitt
BlinkyStitt / building armory-qt
Last active October 31, 2016 06:13
Building BitcoinArmory on OSX up to 10.8
Instructions for 10.9 are in the works.
Install and configure brew
$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
$ touch ~/.bashrc
$ echo "export CFLAGS=\"-arch x86_64\"" >> ~/.bashrc
$ echo "export ARCHFLAGS=\"-arch x86_64\"" >> ~/.bashrc
$ source ~/.bashrc
$ brew update
$ brew doctor
@peterhellberg
peterhellberg / xor.go
Last active July 15, 2017 22:15
XOR Texture in Go with the Pixel package
package main
import (
"image"
"image/color"
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
)