Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@wrburgess
wrburgess / gist:5528649
Last active September 13, 2024 19:00
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@sj26
sj26 / assets.rake
Last active May 13, 2023 04:42
Don't discard cache during asset precompile. Full explanation and caveats: http://sj26.com/2013/02/09/the-asset-pipeline-isnt-actually-slow
# Stick this in lib/tasks/assets.rake or similar
#
# A bug was introduced in rails in 7f1a666d causing the whole application cache
# to be cleared everytime a precompile is run, but it is not neccesary and just
# slows down precompiling.
#
# Secondary consequences are the clearing of the whole cache, which if using
# the default file cache could cause an application level performance hit.
#
# This is already fixed in sprockets-rails for rails 4, but we patch here for
@mrrooijen
mrrooijen / angular-directive-tapable.js.coffee
Last active December 11, 2015 12:29
Adds the `ng-tap` directive for mobile "tap" events. Falls back to a "click" event in case "touch" events aren't present at runtime. For example, when on iOS the tap event would invoke (removing the 300ms click delay) and cancel the Click event (that has the 300ms delay). But, if in a Desktop (mouse) environment, "touch" events are ignored and t…
@App.directive "ngTap", ->
($scope, $element, $attributes) ->
tapped = false
$element.bind "click", ->
$scope.$apply($attributes["ngTap"]) unless tapped
$element.bind "touchstart", (event) ->
tapped = true
$element.bind "touchmove", (event) ->
tapped = false
event.stopImmediatePropagation() # Will otherwise interfere with -webkit-overflow-scrolling: touch
@mrrooijen
mrrooijen / heroku_accounts_git.sh
Created November 28, 2012 16:59
Heroku Accounts Git Clone
# Example:
heroku accounts:default myaccount
git clone [email protected]:myapp.git
@mrrooijen
mrrooijen / README.md
Created October 16, 2012 22:19
Ruby Environment On Mountain Lion

Ruby Environment On Mountain Lion

A quick and easy step-by-step guide to get your Ruby environment up and running again after a fresh install of Mountain Lion. I messed up my installations a few times and figured I'd just put out a Gist once and for all to get this sucker working in one go.

The Steps

First go ahead and install either XCode to get ahold of the Command Line Tools. Or, if you prefer not to install XCode, simply download the latest version directly. This only requires you to provide your Apple ID and password to sign in. You do not need a developers license.

  1. Download the Command Line Tools
  • Or install them through XCode via the preference panel
@mrrooijen
mrrooijen / README.md
Last active July 3, 2024 21:31
Setting up XEN on a Hetzner Dedicated Server

Setting up XEN on a Hetzner Dedicated Server

Author: Michael van Rooijen (@mrrooijen)

DISCLAIMER: I am a programmer, not a sysadmin in my day-to-day life. I provide this guide simply as a self-reference, and as a way to contribute to the community of developers. The main motivation for writing this guide is because of the lack of properly written guides/tutorials. They were either out-dated, inaccurate, in a non-English language or simply too vague to understand (at least for me, as a programmer and not a sysadmin).

I hope this guide helps getting you up and running with your own collection of VPS's on your own Dedicated Server over at Hetzner.de.

Requirements:

@mrrooijen
mrrooijen / README.md
Created August 15, 2012 01:30
Heroku SSL Endpoint, RapidSSL

Heroku SSL Endpoint

Assumptions:

  • You want to enable SSL for your domain.
  • You want to go with RapidSSL.
  • Your domain name is www.domain.com during this example.
  • You want to encrypt requests for a single domain (no wildcard)
  • You want to apply this certificate to Heroku's SSL Endpoint
Mail = Ember.Application.create();
// Let's pretend that Javascript can handle mutliline strings nicely:
Mail.ApplicationView = Ember.View.extend({
template: Ember.Handlebars.compile('
<!-- this gets replaced with content based on state when
connectOutlet is called on ApplicationController -->
{{outlet}}
Mail = Ember.Application.create();
// Let's pretend that Javascript can handle mutliline strings nicely:
Mail.ApplicationView = Ember.View.extend({
template: Ember.Handlebars.compile('
<!-- this gets replaced with content based on state when
connectOutlet is called on ApplicationController -->
{{outlet}}
')
@mrrooijen
mrrooijen / batman-filters.coffee
Created July 31, 2012 18:17
Useful Batman.js Filters.
Batman.mixin Batman.Filters,
isCreating: (model) -> model?.get("lifecycle.state") == "creating"
isSaving: (model) -> model?.get("lifecycle.state") == "saving"
isDestroying: (model) -> model?.get("lifecycle.state") == "destroying"
isPersisting: (model) -> model?.get("lifecycle.state") in ["saving", "creating"]
isUndefined: (input) -> input == undefined
isNull: (input) -> input == null
isBlank: (input) -> input in [undefined, null, ""]