Skip to content

Instantly share code, notes, and snippets.

View alakra's full-sized avatar
🏐
Focusing

Angelo Lakra alakra

🏐
Focusing
View GitHub Profile
@alakra
alakra / gist:2773476
Created May 23, 2012 05:56
rails 3 engine notes from ruby boulder talk
Why we need to structure our apps using engines within Rails Applications
model != controllers|views
controllers != models|1view
views != some models--->whatever these have
put core code into external engine (not the other way around)
rails plugin new myengine --full --mountable (places engine in namespaced module)
engines folder -> with engines1, engines2, etc.
structured app
@alakra
alakra / class_state.rb
Created May 22, 2012 03:43
Managing State at the Class Level in Ruby
#!/usr/bin/env ruby
# Class Variables
# One quick way to manage references between sub-classes through a parent class
# is to use a class variable. Class variable are designated by `@@` in front of a variable name.
# e.g.
class Foo
@@configuration_file = 'foo/bar.yml'
@alakra
alakra / gist:2346411
Created April 9, 2012 20:32
paperclip 3.0.1
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from paperclip:
##################################################
# NOTE FOR UPGRADING FROM PRE-3.0 VERSION #
##################################################
Paperclip 3.0 introduces a non-backward compatible change in your attachment
path. This will help to prevent attachment name clashes when you have
multiple attachments with the same name. If you didn't alter your
attachment's path and are using Paperclip's default, you'll have to add
@alakra
alakra / gist:2015154
Created March 11, 2012 05:32
Dungeon Crawl 0.10.0 compile error on Ubuntu 11.10 (64 bit)
make
* If you experience any problems building Crawl, please take a second look
* at INSTALL.txt: the solution to your problem just might be in there!
* rebuilding crawl: new build flags or prefix
* Need to build contribs: lua/src
make[1]: Entering directory `/media/Storage/rp-archive/raw/dungeon-crawl-soup/stone_soup-0.10.0/source/contrib'
make[2]: Entering directory `/media/Storage/rp-archive/raw/dungeon-crawl-soup/stone_soup-0.10.0/source/contrib/lua/src'
* rebuilding lua: new build flags or prefix
CC lapi.o
CC lcode.o
module Jekyll
class MembersGenerator < Generator
safe true
def generate(site)
puts "Test!!!!"
end
end
end
safe: true
source: .
plugins: ./_plugins
destination: _site
lsi: true
pygments: true
[1 of 1] Compiling Main ( /tmp/haskell-src-exts-1.11.124942/haskell-src-exts-1.11.1/Setup.hs, /tmp/haskell-src-exts-1.11.124942/haskell-src-exts-1.11.1/dist/setup/Main.o )
Linking /tmp/haskell-src-exts-1.11.124942/haskell-src-exts-1.11.1/dist/setup/setup ...
Configuring haskell-src-exts-1.11.1...
setup: happy version >=1.17 is required but it could not be found.
cabal: Error: some packages failed to install:
haskell-src-exts-1.11.1 failed during the configure step. The exception was:
ExitFailure 1
@alakra
alakra / gist:1125975
Created August 4, 2011 19:13
translate your name to japansee
class String
JP_TRANSFORM = {
"a" => "ka",
"b" => "tu",
"c" => "mi",
"d" => "te",
"e" => "ku",
"f" => "lu",
"g" => "ji",
@alakra
alakra / gist:1106022
Created July 26, 2011 05:13
Prettify XML with a key combo in Emacs
(defun bf-pretty-print-xml-region (begin end)
"Pretty format XML markup in region. You need to have nxml-mode
http://www.emacswiki.org/cgi-bin/wiki/NxmlMode installed to do
this. The function inserts linebreaks to separate tags that have
nothing but whitespace between them. It then indents the markup
by using nxml's indentation rules."
(interactive "r")
(save-excursion
(nxml-mode)
(goto-char begin)
@alakra
alakra / Questions
Created June 21, 2011 17:41
Kiwi Pycon Give-away
GitHub username: fozze
Day job: Software Developer
Favorite open source project: curveship
Open Source contributions (if any):
Stranded on an island, what 3 items do you take: knife, hammer, shovel
Tie-breaker, pick a number between 1 and 20,000: 7659