Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / resque_stale_worker_cleaner.rb
Last active August 29, 2015 14:07
Prune stale Resque workers.
class ResqueStaleWorkerCleaner
SLOWEST_JOB = (ENV["SLOWEST_JOB"] || 30).to_i # minutes
def call
Resque.workers.each do |worker|
worker.unregister_worker if old_worker?(worker)
end
end
private
@mrrooijen
mrrooijen / api_base_controller.rb
Last active August 29, 2015 14:05
Ember.js + Rails API setup with header-based API key and API version configuration.
class Api::BaseController < ActionController::Base
protect_from_forgery with: :null_session
before_action :unauthorized_if_signed_out
layout false
def current_user
@current_user ||= (
authenticate_or_request_with_http_token do |token, options|
User.find_by(api_key: token)
end
@callumacrae
callumacrae / build-tools.md
Last active October 25, 2023 15:14
Build tools written in JavaScript
@mrrooijen
mrrooijen / hdiutil.sh
Last active January 2, 2016 22:59
Set of commands for creating OSX Journaled (Extended) Encrypted images. Attaching them. Detaching them. Attaching them on system boot.
# Create a 10 megabytes, blank, AES 256 Encrypted, with password "mypassword",
# MacOS Journaled (Extended) image named "MyImage" when attached,
# and myimage.dmg as filename in the current directory.
#
echo -n "mypassword" | hdiutil create \
-encryption AES-256 \
-stdinpass \
-size 10m \
-fs "Journaled HFS+" \
-volname MyImage \
Incoming Server Settings:
Incoming Server Name: imap.zoho.com
Port: 993
Require SSL: Yes
Outgoing Server Settings:
Outgoing Server Name: smtp.zoho.com
Port: 465
Require SSL: Yes
Require Authentication: Yes
@mrrooijen
mrrooijen / Z77-DS3H.md
Created August 20, 2013 01:46
Gigabyte Z77-DS3H Motherboard MultiBeast Configuration.

Gigabyte Z77-DS3H Motherboard MultiBeast Configuration.

  • UserDSDT or DSDT-Free Installation
  • Drivers & Bootloaders->Drivers->Audio->Realtek ALC8xx->Without DSDT->ALC887/888b->v100302 Current
  • Drivers & Bootloaders->Drivers->Disk->TRIM Enabler->10.8.3+ TRIM Patch
  • Drivers & Bootloaders->Network->Atheros - Shailua's ALXEthernet
/* Initialisation / Button events */
// If added to home screen...
if(navigator.standalone === undefined || !!navigator.standalone) {
// On Android scroll the screen by 1 pixel to hide the address bar
if (navigator.userAgent.match(/Android/i)) {
window.addEventListener("load", function() { window.scrollTo(0,1); }, false);
}
// Show the converter & hide the install option by default
require 'faye'
Faye::WebSocket.load_adapter('thin')
use Faye::RackAdapter, :mount => '/faye', :timeout => 25
require ::File.expand_path('../config/environment', __FILE__)
run App::Application
Child of Light (RPG)
Bound by Flame (Action/RPG)
LORDS OF THE FALLEN (Action/RPG)
Dying Light (Action)
Kingdom Hearts III (Action/RPG)
Deep Down (Action/RPG)
Project Phoenix (RPG)
Kingdom Come: Deliverance (RPG)
Tom Clancy's The Division (Online Shooter/RPG)
The Witcher 3: Wild Hunt (Action/RPG)
@kylev
kylev / foggy.rb
Last active December 17, 2015 08:29
Examples for streaming data to/from S3 via Fog.
# Create happily takes IO-like objects as body.
file = directory.files.create(
:key => 'giant_linux_distro.iso',
:body => File.open("nightly.iso"), # No ma! No read()!
:public => true
)
# Get will take a block for streamy goodness.
directory.files.get("giant_thing.bin") do |chunk, remaining, total|
output.write(chunk)