Skip to content

Instantly share code, notes, and snippets.

View galtenberg's full-sized avatar

Christopher Galtenberg galtenberg

View GitHub Profile
@onlurking
onlurking / programming-as-theory-building.md
Last active October 5, 2024 10:39
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@omz
omz / UI Debugging Overlay.py
Last active January 6, 2024 05:44
UI Debugging Overlay.py
# Pythonista script to show the UI Debugging overlay (private API) described in this blog post:
# http://ryanipete.com/blog/ios/swift/objective-c/uidebugginginformationoverlay/
from objc_util import ObjCClass, on_main_thread
UIDebuggingInformationOverlay = ObjCClass('UIDebuggingInformationOverlay')
@on_main_thread
def toggle_overlay():
UIDebuggingInformationOverlay.prepareDebuggingOverlay()
UIDebuggingInformationOverlay.overlay().toggleVisibility()
@lfbittencourt
lfbittencourt / clear_tags.rb
Last active March 21, 2017 11:03
This Ruby script removes all local and remote tags in a single-line way, so you don't need supply your credentials several times. Optionally, you can remove only tags greater than a specific version.
#!/usr/bin/env ruby
# Only tags >= min_tag will be removed.
min_tag = '0.0.0'
tags = `git tag`.split(/\s+/).select do |t|
Gem::Version.new(t) >= Gem::Version.new(min_tag)
end
`git tag -d #{tags.join ' '}`
`git push origin #{tags.map { |t| ':' + t }.join ' '}`
@staltz
staltz / introrx.md
Last active October 3, 2024 12:39
The introduction to Reactive Programming you've been missing
@scrogson
scrogson / config-initializers-sandbox_email_interceptor.rb
Last active August 29, 2015 14:00
Intercept outgoing email in environments outside of production.
# config/initializers/sandbox_email_interceptor.rb
ActionMailer::Base.register_interceptor(SandboxEmailInterceptor) unless Rails.env.production?
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@gustafnk
gustafnk / poll_twitter_favorites.js
Last active December 28, 2015 12:09
List all your twitter favorites - slow and dirty. You must be on your twitter favorites page. When done, do "Inspect Element" and copy the html tag, then paste it into a text editor and save.
var poll = function(){
window.scrollTo(0, document.body.scrollHeight);
setTimeout(function(){ poll() }, 500);
};
poll();
@jbenet
jbenet / simple-git-branching-model.md
Last active September 19, 2024 16:05
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@thbar
thbar / Guardfile
Last active December 15, 2015 10:28
How to automatically restart the simulator in RubyMotion when code is updated (beta version!)
require 'childprocess'
guard 'shell' do
watch %r{^app/(.+)\.rb$} do |m|
`killall rake`
# Why this:
# - spawn a child process to avoid locking Guard
# - make sure that the child process has stdout and stdin otherwise it crashes
# - bonus point: get REPL access in the simulator!
@sentientmonkey
sentientmonkey / test-logging.rb
Last active December 15, 2015 04:09
hourly log rotation in ruby logger via rotatelogs
#!/usr/bin/env ruby
require 'logger'
# rotatelogs required...
# http://httpd.apache.org/docs/2.2/programs/rotatelogs.html
logger = Logger.new("|rotatelogs ./foo.log.%Y-%m-%d-%H 3600", 0, 0)
10.times do
logger.error "testing..."