Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Schmidt dsci

View GitHub Profile
@dsci
dsci / duck.spec.ts
Created Jul 15, 2019
Strategy Pattern - Typescript // Duck Behaviour
View duck.spec.ts
import { expect } from 'chai';
import 'mocha';
import {
FlyWithWings,
FlyNoWay,
Quack,
MuteQuack,
Duck,
DuckWithAlternativeConstructor
View reflection.php
<?php
// example code
function dynamicCall($someMsg) {
try {
$method = new ReflectionMethod('Foo', $someMsg);
$method->invoke(new Foo());
}catch(Exception $error){
exitTheHell($error);
}
View singleton_cvar.rb
class SingletonCvar
def self.instance
@@instance ||= new
end
private_class_method :new
end
singleton = SingletonCvar.instance
@dsci
dsci / rake.rb
Last active Feb 2, 2016
Rake Tasks from classes
View rake.rb
# Use instance methods of classes as Rake tasks:
#
# In a folder tasks, create your classes.
#
# class FooTask
# extend RakeDecorator
#
# task :numbers, desc: 'A funny task that prints out the first 10 numbers'
# def print_numbers_task
# puts (1..10).to_a.join(',')
@dsci
dsci / private_accessing.rb
Last active Aug 29, 2015
private_accessing.rb
View private_accessing.rb
class Bar
def self.foobar
end
private_class_method :foobar
end
@dsci
dsci / Dockerfile
Last active Aug 29, 2015 — forked from konklone/Dockerfile
Rachel Dockersetup
View Dockerfile
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
View authlogic-to-devise.md

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
View 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/'
@dsci
dsci / index.html
Created Aug 5, 2013
A CodePen by Daniel Schmidt.
View index.html
<canvas id="404" width="600" height="600"></canvas>