Skip to content

Instantly share code, notes, and snippets.

View timoschilling's full-sized avatar
👻
yolo

Timo Schilling timoschilling

👻
yolo
View GitHub Profile
# This template is a Cloud Formation template, that has AWS Sam seamlessly mixed in
# It is extremely powerful as you will see!
# This is a template of Lambda & RDS, publically available (so no private VPC)
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31 # This is to tell cloudformation we need to transform this template, as it has SAM!
Description: Severless set up with an RDS
######## ### ######## ### ## ##
## ## ## ## ## ## ## ## ### ###
@varyonic
varyonic / gist:542c37648de91a02402a
Last active August 29, 2015 14:08
Deprecated but working version of form_buffers removed by https://github.com/activeadmin/activeadmin/pull/3486
module ActiveAdmin
module Views
class ActiveAdminForm
class DeprecatedFormBufferSubstitute
def initialize(form)
@form = form
end
def << (value)
@form.text_node value.html_safe
end
@bumi
bumi / git.txt
Created October 23, 2013 15:38
Some links on where you find help to get started with git
* http://www.youtube.com/user/GitHubGuides/videos - github video guides
* http://gitimmersion.com/ - a guided tour that walks through the fundamentals of git.
* http://try.github.io/ - an interactive git tutorial to try and learn the basic git commands
* http://training.github.com/ - the github training page. they offer free git webinars
* https://www.codeschool.com/courses/git-real - git course on code school. great interactive course by the codeschool peeps.
* http://opentechschool.github.io/social-coding/ - the opentechschool course
* http://rogerdudler.github.io/git-guide/ - another simple and short git guide
* http://think-like-a-git.net/ - think like a git
* http://git-scm.com/book - full book about git. if you want to learn everything
* http://git-scm.com/book/en/Getting-Started-Git-Basics - a more technical introduction
@schnittchen
schnittchen / routes.rb
Created March 3, 2013 21:06
Routing constraints tied to your app without breaking reloading in development mode
# Sometimes Constraints need to interact with controllers (fex. in order not to query the database twice), then I like
# to put them inside the controller. If you load controllers from your routes.rb (more precisely, when routes.rb is loaded),
# these won't reload in development mode.
# If your constraints live somewhere else (say, /app/constraints), it's basically all the same.
# This demonstrates an easy workaround by wrapping the fetching of constraints in a block:
class ConstraintWrapper
# Helps to load constraints from inside controllers without breaking
# development environment reloading

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

@itod
itod / remove_prefix.applescript
Last active November 21, 2016 03:56
AppleScript to remove a common prefix from the name of all files in a given folder.
set path_ to (get path to desktop as string) & "FOLDER NAME HERE"
set prefix_ to "PREFIX HERE"
tell application "Finder"
set dir_ to folder path_
set files_ to items of dir_ whose name of it starts with prefix_
set start_ to (get length of prefix_) + 1
repeat with file_ in files_
set oldname_ to name of file_
set end_ to length of oldname_
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@steveklabnik
steveklabnik / proposal.md
Created June 25, 2012 17:44
Development and Philosophy

We spend most of our times obsessing about the actual act of programming. Is this method name too long? Should I refactor this code? How do I fix this bug? However, sometimes, large gains can be made by drawing in experience from totally different fields.

I think there's a lot a programmer can learn from the study of epistemology, logic, metaphysics, moral and political philosophy, and aesthetics. In this talk, I'll give an overview of a bunch of interesting thinkers, philosophical problems, and how they relate to the worlds of software development, open source, and startups.

@stevenh512
stevenh512 / gitconfig-git
Created June 11, 2012 10:51
URL rewriting in .gitconfig
# Use git and git+ssh instead of https
[url "git://github.com/"]
insteadOf = https://github.com/
[url "git@github.com:"]
pushInsteadOf = "git://github.com/"
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
@fujin
fujin / foo.rb
Created January 31, 2012 21:49
template override between cookbooks
template "/tmp/foo.rb"
source "foo.rb.erb"
cookbook "banana"
end