Skip to content

Instantly share code, notes, and snippets.

View mhenrixon's full-sized avatar
🐢
I may be slow to respond.

Mikael Henriksson mhenrixon

🐢
I may be slow to respond.
View GitHub Profile
@mhenrixon
mhenrixon / tUnit2Rspec
Created November 26, 2020 21:29 — forked from yannis/tUnit2Rspec
Test::Unit to Rspec conversion ruby script
require "highline/import"
from_path = ask "Enter path for file to convert: "
to_path = ask "Enter the path where to save the spec file: "
unless File.exists? from_path
puts "Sorry this file doesn't exist!: #{from_path}"
puts "Please try again"
return
end
t_unit = File.read(from_path).to_s
@mhenrixon
mhenrixon / syntax_highlighting.py
Created January 15, 2012 08:39 — forked from davelnewton/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """
def on_load(self, view):
filename = view.file_name()
@mhenrixon
mhenrixon / facebook_registration.rb
Created July 15, 2018 14:03 — forked from nicalpi/facebook_registration.rb
Testing Omniauth with Devise, Rspec and Capybara
background do
set_omniauth()
click_link_or_button 'Sign up with Facebook'
end
@mhenrixon
mhenrixon / docker-compose.yml
Created March 23, 2017 10:33 — forked from mdub/docker-compose.yml
How to share a /usr/local/bundle cache between Ruby build jobs
version: "2"
services:
dev:
image: ruby:2.3
volumes:
- .:/project
- ruby2.3-bundle-cache:/usr/local/bundle
working_dir: /project
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
$snapins = Get-PSSnapin -Registered
$snapins | Add-PSSnapin
Get-Module -ListAvailable | Import-Module
Get-PSSnapin | Format-Table -autosize PSVersion, Name
Get-Module | Format-Table -autosize ModuleType, Name
function ff ([string] $glob) { get-childitem -recurse -include $glob }
Update server
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo reboot
Enable Swedish locale and utf-8
sudo locale-gen sv_SE.UTF-8
sudo dpkg-reconfigure locales
Open sudo vim /etc/environment and add the folowing lines
# Example usage:
require 'active_record/nonpersisted_attribute_methods'
class Node < ActiveRecord::Base
include ActiveRecord::NonPersistedAttributeMethods
define_nonpersisted_attribute_methods [:bar]
# Example of using with ancestry and getting :parent to show up in changes hash.
has_ancestry
define_nonpersisted_attribute_methods [:parent]
@mhenrixon
mhenrixon / 0-readme.md
Last active December 14, 2015 02:48 — forked from kenmazaika/0-readme.md

ruby-1.9.3-p385 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p385 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@mhenrixon
mhenrixon / 0-readme.md
Last active December 13, 2015 22:39 — forked from burke/0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.