Skip to content

Instantly share code, notes, and snippets.

View bitops's full-sized avatar

Sebastian Wittenkamp bitops

View GitHub Profile
@seanlilmateus
seanlilmateus / tap.swift
Last active August 29, 2015 14:02
`tap:` method for Swift borrowed from Ruby. ( a little broken, Cast needed)
import Cocoa
extension NSObject {
func tap(blk:(AnyObject) -> Void) -> Self {
blk(self as NSObject)
return self
}
}
// Alternative, you will need to specify the type :: view:NSView = ...
@raym
raym / followScroll.js
Last active August 29, 2015 14:07
javascript for having a sidebar element follow you as you scroll -- behavior modeled after facebook sidebar
var wrapperId = 'sidebarWrapperIdOnPage';
var
$w = $(window),
$wrap = $('#'+wrapperId),
followerInitialOffset = $wrap.offset().top,
marginTop = 0,
$wrap, windowTop, windowBottom, followerHeight,
followerTop, followerBottom, followerBottomPosition
;
@jamis
jamis / lap_timer.rb
Created June 6, 2011 22:02
A simple helper for timing sequences of code.
# Easy to use:
#
# timer = LapTimer.new
# # some task that might take awhile
# timer.mark :step2
# # another task that needs timing
# timer.mark :step3
# # and another task to time
# timer.report
#
@jamis
jamis / demo.rb
Created August 3, 2011 21:56
Repairing a unicode string that contains invalid characters
# encoding: utf-8
s = "Blah \xe9 blah 헌글"
puts "BEFORE"
puts "encoding: #{s.encoding}"
puts "valid : #{s.valid_encoding?}"
puts "text : #{s}"
s = s.
@mbbx6spp
mbbx6spp / t4r-client-examples.rb
Created August 28, 2011 02:37
Examples of using Twitter4R (Ruby gem library to access the Twitter.com REST and Search APIs).
# Below are examples of how to initialize and use a Twitter::Client object for each Twitter user
# Can initialize by passing in Hash of oauth_access information for the authenticated user driving calls
# through Twitter4R
twitter = Twitter::Client.new(:oauth_access => {
:key => ACCESS_KEY, :secret => ACCESS_SECRET })
# Can also initialize by loading in file configuration file and specifying YAML key name to use for user:
twitter = Twitter::Client.from_config("file/name/to/config.yml", "key") # YAML file will look like twitter.yml
##### STATUS APIs ######
anonymous
anonymous / debugging.txt
Created May 11, 2016 18:51
Standard debugging email help
Hello, I'm glad you contacted me asking for help. In order to help you help
yourself I have crafted this fine little automated email with information and
things you should try before asking for help. When you run into a problem I
want you to do the following things before you email me, and then email me your
answers. Doing this will most likely help you solve the problem on your own,
and will save me time in the long run. If after doing this you are truly
stuck and you can answer all these questions then email me your answers and
I'll help you.
1. Do you have a screenshot of the error you are getting?
@mattt
mattt / nshipster-new-years-2015.md
Created November 25, 2014 19:38
NSHipster New Year's 2015

Season's Greetings, NSHipsters!

As the year winds down, and we take a moment to reflect on our experiences over the past months, one thing is clear: 2014 has been an incredible year professionally for Apple developers. So much has happened in such a short timespan, and yet it's hard to remember our relationship to Objective-C before Swift, or what APIs could have captivated our imagination as much as iOS 8 or WatchKit.

It's an NSHipster tradition to ask you, dear readers, to send in your favorite tips and tricks from the past year for publication over the New Year's holiday. This year, with the deluge of new developments—both from Cupertino and the community at large—there should be no shortage of interesting tidbits to share.

Submit your favorite piece of Swift or Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

If you're wondering about what to post, look to

@bitops
bitops / richhickey.md
Created April 18, 2018 03:18 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@danielhawkes
danielhawkes / MediaPlayerStateWrapper.java
Created June 16, 2011 15:58
A drop-in replacement for a MediaPlayer instance, that provides an accessor for the current state.
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import android.media.AudioManager;
import android.media.MediaPlayer;
@owainlewis
owainlewis / hipchat.el
Created May 8, 2013 10:58
HipChat Jabber Emacs
;; HipChat
(setq ssl-program-name "gnutls-cli"
ssl-program-arguments '("--insecure" "-p" service host)
ssl-certificate-verification-policy 1)
;; Connect using jabber.el
;; M-x jabber-connect <RET>
;; Config