Skip to content

Instantly share code, notes, and snippets.

View dsci's full-sized avatar

Daniel Schmidt dsci

  • Leipzig, Germany
View GitHub Profile
@dsci
dsci / Dockerfile
Last active August 29, 2015 14:19 — forked from konklone/Dockerfile
Rachel Dockersetup
FROM ubuntu
MAINTAINER ''
# Needed?
# turn on universe packages
#RUN echo "deb http://archive.ubuntu.com/ubuntu raring main universe" > /etc/apt/sources.list
# Prepare Ubuntu and Rachel dependencies
RUN apt-get update
RUN apt-get install -y build_essential

How To: Authlogic to Devise

Step 1: Migration

  1. bin/rails g migration AuthlogicToDevise
  2. (see the file below for the actual migration, authlogic_to_devise.rb)
  3. bin/rake db:migrate

Step 2: Update Gemfile

  1. gem "devise", "~> 2.2.0"
  2. bundle install
@dsci
dsci / mono.rb
Last active December 26, 2015 04:49 — forked from shtirlic/mono.rb
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
url 'http://download.mono-project.com/sources/mono/mono-3.2.3.tar.bz2'
sha1 'e356280ae45beaac6476824d551b094cd12e03b9'
homepage 'http://www.mono-project.com/'
{
"cmd": ["bash", "-c", "clang -lobjc -framework Cocoa -framework Carbon -o /tmp/sublime-objc-output $file"],
"file_regex": "^(.*?):([0-9]+):([0-9]+): (.*)",
"selector": "source.objc",
"variants": [
{
"name": "Run",
"cmd": ["bash", "-c", "clang -lobjc -framework Cocoa -framework Carbon -o /tmp/sublime-objc-output $file && /tmp/sublime-objc-output"]
}
]
@dsci
dsci / class.coffee
Last active December 14, 2015 23:59 — forked from lancejpollard/class.coffee
moduleKeywords = ['included', 'extended', 'prototype']
class Class
# Rename an instance method
#
# ``` coffeescript
# class User
# @alias "methods", "instance_methods"
#
# ```
@dsci
dsci / module.coffee
Created March 14, 2012 13:45 — forked from olivoil/module.coffee
Mixins/Modules behavior in coffeescript. Thought of to be used with Backbone.js applications
# define module behavior
class Module
keywords = ['extended', 'included', 'initialize']
@extend = (obj) ->
for key, value of obj when key not in keywords
@[key] = value
obj.extended?.apply(@)
this
@dsci
dsci / gist:1883477
Created February 22, 2012 08:56 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
@dsci
dsci / each_with_index.js
Created February 6, 2012 17:54 — forked from burin/each_with_index.coffee
each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
// {{#each_with_index records}}
// <li class="legend_item{{index}}"><span></span>{{Name}}</li>
// {{/each_with_index}}
Handlebars.registerHelper("each_with_index", function(array, fn) {
var buffer = "";
for (var i = 0, j = array.length; i < j; i++) {
var item = array[i];
// stick an index property onto the item, starting with 1, may make configurable later
@dsci
dsci / face_detector.rb
Created December 7, 2011 17:47 — forked from pvinis/face_detector.rb
run with "macruby face_detector.rb" or "macruby face_detector.rb https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc7/304055_10150415385415891_522505890_10347873_1682210515_n.jpg?dl=1" for a photo of me with woody and buzz lightyear :p
framework 'Cocoa'
class NSColor
def toCGColor
color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace)
## approach #1
# components = Array.new(4){Pointer.new(:double)}
# color_RGB.getRed(components[0],
# green: components[1],
# blue: components[2],
@dsci
dsci / config.ru
Created December 5, 2011 14:57 — forked from thomasyip/config.ru
Sinatra + Warden & Rails + Devise Example
# /config.ru
# This file is used by Rack-based servers to start the application.
# File generated by "rails create MyApp"
# For Rails
require ::File.expand_path('../config/environment', __FILE__)
# For Sinatra
require './slim/slim.rb'
# - Make sinatra play nice