This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Picture < ActiveRecord::Base | |
def self.new_from_flickr_photo(photo) | |
picture = Picture.new | |
picture.set_attributes_from_flickr_photo(photo) | |
picture | |
end | |
def set_attributes_from_flickr_photo(photo) | |
# copy whichever attributes you might need |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Reloads tun and tap kernel extensions on OSX | |
# Sometimes helps with VPN not being able to connect | |
kextunload -b foo.tun | |
kextunload -b foo.tap | |
kextload /Library/Extensions/tun.kext | |
kextload /Library/Extensions/tap.kext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Author: Maciej Bilas (@maciejb) | |
# Based on http://david-burger.blogspot.com/2010/01/truncate-all-tables-in-mysql-database_31.html | |
# https://gist.github.com/290596 | |
usage() { | |
echo "\ | |
Usage: $0 -u username -d database [-h host] [-o port)] \\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO replace the magic 57 with an actual match of the prefix | |
perl -pe 's/.{57}('.*')\);$/\1/' entries.txt | tr "[:lower:]" "[:upper:]" | sed "s/'//g" | sed -E 's/([^A-Z])+/_/g' | perl -e '$i = 1; while (<>) {chomp; printf("%s(\"%04d\"),\n", $_, $i); $i = $i + 1}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name ".svn" -exec rm -rf {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROJECT_NAME="$1" | |
SCALA_VERSION="2.9.1" | |
SCALATEST_VERSION="1.6.1" | |
MOCKITO_VERSION="1.8.5" | |
mkdir $PROJECT_NAME | |
cd $PROJECT_NAME | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Maciej Bilas | |
* @since 16/10/12 11:01 | |
*/ | |
public class A { | |
private final boolean produced; | |
public A() { | |
this.produced = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load 'deploy' unless defined?(_cset) | |
_cset :asset_env, "RAILS_GROUPS=assets" | |
_cset :assets_prefix, "assets" | |
_cset :assets_role, [:web] | |
_cset :normalize_asset_timestamps, false | |
before 'deploy:finalize_update', 'deploy:mm_assets:symlink' | |
after 'deploy:update_code', 'deploy:mm_assets:precompile' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rest-client' | |
sleep 4 | |
loop do | |
sleep 1 | |
response = begin | |
RestClient.get("http://localhost:8080/app/diagnostics.json") |
OlderNewer