Skip to content

Instantly share code, notes, and snippets.

View dentarg's full-sized avatar
🌦️
=:D><!

Patrik Ragnarsson dentarg

🌦️
=:D><!
View GitHub Profile
@dentarg
dentarg / gist:492760
Created July 27, 2010 19:51
Python test
$ python test.py
hello
$ cat test.py
import test2
$ cat test2.py
print "hello"
@dentarg
dentarg / convert-functions.rb
Created October 21, 2010 16:28
Some functions to convert binary to hex and vice versa
#!/usr/local/bin/ruby
# bin functions
def bin2dec(str)
return eval("0b#{str}.to_i")
end
def bin2hex(str)
return "todo"
end
@dentarg
dentarg / github_hire_scraper.rb
Created March 17, 2012 23:22 — forked from jamster/github_hire_scraper.rb
How many fucking people have gitub hired?
require 'rubygems'
require 'activesupport'
require 'bad_ass_extensions'
require 'nokogiri'
require 'open-uri'
require 'date'
class GitHubber
attr_accessor :header, :name, :date, :date_string, :links, :post
diff --git a/Gemfile.lock b/Gemfile.lock
index d38bfea..ba6025d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,8 +1,8 @@
GEM
remote: http://rubygems.org/
specs:
- addressable (2.2.6)
- backports (2.3.0)
@dentarg
dentarg / linebreak.rb
Created May 22, 2012 14:41
Which line break method do you prefer?
def method1
if @something.save
flash[:success] = "Woho! Great success to add
add #{@something} to the
list of things."
end
end
def method2
if @something.save
@dentarg
dentarg / brew --config
Created May 27, 2012 11:07
Problem installing bsdmake with Homebrew
HOMEBREW_VERSION: 0.9
HEAD: f3f601b7bbbbc621fb49b8aa08f0705cb5306adb
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
class Larmobjekt
property: marke, Enum[ ... ]
def marken_for_select
Larmobjekt.marken.map do |marke|
{
marke: marke
selected: marke.eql?(self.marke)
}
end
class String
alias_method :real_downcase, :downcase
alias_method :real_upcase, :upcase
alias_method :real_capitalize, :capitalize
def downcase
self.real_downcase.tr('ÅÄÖ', 'åäö')
end
def upcase
https://gist.github.com/2931277
def namn
StringExtension.capitalize(Larmobjekt.to_swedish(self.class.to_s.downcase))
end