Skip to content

Instantly share code, notes, and snippets.

View kjellski's full-sized avatar
🤓
learning every day...

Kjellski kjellski

🤓
learning every day...
View GitHub Profile
[~/Sites/app] cucumber --drb
Using the default profile...
Disabling profiles...
Exception encountered: #<RuntimeError: Application has been already initialized.>
backtrace:
/Users/pma/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application.rb:91:in `initialize!'
/Users/pma/.rvm/gems/ruby-1.9.2-p290/gems/cucumber-rails-1.0.2/lib/cucumber/rails/application.rb:15:in `initialize!'
/Users/pma/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/pma/Sites/app/config/environment.rb:5:in `<top (required)>'
/Users/pma/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
@gigamonkey
gigamonkey / FizzBuzz.scala
Created May 14, 2013 20:21
I don't always write FizzBuzzes, but when I do, I do it without modulus.
object FizzBuzz extends App {
val nones = Stream.continually(None)
val fizzes: Stream[Option[String]] = nones.take(2) ++ Some("Fizz") #:: fizzes
val buzzes: Stream[Option[String]] = nones.take(4) ++ Some("Buzz") #:: buzzes
for (((fizz, buzz), n) <- fizzes zip buzzes zip (1 to 100)) {
println(fizz.map(_ + buzz.getOrElse("")).orElse(buzz).getOrElse(n))
}
@xplicit
xplicit / monodevelop.sh
Last active December 24, 2015 10:29
Compile and install current dev version of Mono (3.4.1) and Monodevelop (5.1) on Ubuntu
#!/bin/sh
sudo apt-get install git mono-mcs mono-gmcs autoconf libtool g++ libglib2.0-cil-dev libgtk2.0-cil-dev libglade2.0-cil-dev libgnome2.0-cil-dev libgconf2.0-cil-dev
mkdir mono
cd mono
git clone https://github.com/mono/mono.git
git clone https://github.com/mono/monodevelop.git
git clone https://github.com/mono/xsp.git
git clone https://github.com/mono/mono-addins.git
cd mono
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
//returns a promise that resolves after a time
function wait(time){
return new Promise(function(resolve){
window.setTimeout(resolve,time);
});
}
//a function that, if called with just a time,
//returns a function that will return a wait...
//that resolves with whatever value it was given
// groupcities.js
// An alternative solution to:
// https://dev.to/albinotonnina/how-to-lose-a-it-job-in-10-minutes-35pi
//
// Given an array of city names, group the ones that are rotations of
// each other together. e.g.:
//
// input: ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']
// output:
// [
@ThomasArdal
ThomasArdal / gist:5132711
Created March 11, 2013 08:10
Remote creation of IIS websites.
$username = "insert_username_here"
$password = ConvertTo-SecureString "insert_password_here" -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$password
$session = New-PSSession "insert_hostname_here" -Credential $credential
Invoke-Command -Session $session -ScriptBlock {
Set-ExecutionPolicy RemoteSigned
Import-Module WebAdministration
New-Item iis:\Sites\%teamcity.build.branch%.insert_local_name_here -bindings @{protocol="http";bindingInformation=":80:%teamcity.build.branch%.insert_local_name_here"} -physicalPath c:\inetpub\wwwroot\%teamcity.build.branch%.insert_local_name_here
Set-ItemProperty 'IIS:\Sites\%teamcity.build.branch%.insert_local_name_here' ApplicationPool "ASP.NET v4.0"
@iaian
iaian / sublimeText2_contextMenu.reg
Last active January 15, 2019 15:46
Add SublimeText 2 context menu to windows explorer. If item is folder, context menu has option "open in sublimetext project". If is file, "open in sublime text 2" option is added to context menu. Tested on windows 7
Windows Registry Editor Version 5.00
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@Virtlink
Virtlink / TypeSwitch.cs
Last active March 9, 2019 17:11
Switch on type. The order of the Case() methods is important.
using System;
namespace Virtlink
{
/// <summary>
/// Executes a particular piece of code based on the type of the argument.
/// </summary>
/// <example>
/// Usage example:
/// <code>
@funkotron
funkotron / docker_create_treeio.sh
Last active December 18, 2019 17:56
Using Docker (requires docker to be installed http://www.docker.io/gettingstarted/ ), spawn a postgresql instance and a dynamically configured treeio instance.
#!/bin/bash
# Description: Using Docker (requires docker to be installed http://www.docker.io/gettingstarted/ ), spawn a postgresql instance and a dynamically configured treeio instance
# Also requires postgresql client tools http://www.postgresql.org/download/linux/ubuntu/
# Run chmod +x to make this file executable then run it: ./docker_create_treeio.sh
# Author: Adam Awan
# Email: adam@tree.io
# Set the port to forward for Tree.io
TREEIO_PORT="80"