Skip to content

Instantly share code, notes, and snippets.

View alakra's full-sized avatar

Angelo Lakra alakra

View GitHub Profile
@alakra
alakra / gist:822664
Created February 11, 2011 17:02
checking for sudo access (from bundler gem)
def requires_sudo?
return @requires_sudo if @checked_for_sudo
path = bundle_path
path = path.parent until path.exist?
sudo_present = !(`which sudo` rescue '').empty?
@checked_for_sudo = true
@requires_sudo = settings.allow_sudo? && !File.writable?(path) && sudo_present
end
@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
@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 / 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",
[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
safe: true
source: .
plugins: ./_plugins
destination: _site
lsi: true
pygments: true
module Jekyll
class MembersGenerator < Generator
safe true
def generate(site)
puts "Test!!!!"
end
end
end
@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
@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 / 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'