This file contains 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 -wKU | |
# http://blog.grayproductions.net/articles/the_unicode_character_set_and_encodings | |
module UTF8Checksum | |
def is_utf8? | |
where_we_were = pos | |
begin | |
loop do | |
break if eof? | |
first_byte = "%08b" % read(1)[0] |
This file contains 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 | |
# put in /etc/munin/plugins and restart munin-node | |
# by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin | |
# NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats | |
def output_config | |
puts <<-END | |
graph_category App | |
graph_title Passenger memory stats | |
graph_vlabel count |
This file contains 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
-(UIImage*)imageByScalingToSize:(CGSize)targetSize | |
{ | |
UIImage* sourceImage = self; | |
CGFloat targetWidth = targetSize.width; | |
CGFloat targetHeight = targetSize.height; | |
CGImageRef imageRef = [sourceImage CGImage]; | |
CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); | |
CGColorSpaceRef colorSpaceInfo = CGImageGetColorSpace(imageRef); | |
This file contains 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
#include <sys/types.h> | |
#include <ifaddrs.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
- (NSString *)getIPAddress | |
{ | |
NSString *address = @"error"; | |
struct ifaddrs *interfaces = NULL; | |
struct ifaddrs *temp_addr = NULL; | |
int success = 0; |
This file contains 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
require 'rubygems' | |
require 'oauth' | |
KEY = "replace with your key" | |
SECRET = "replace with your secret" | |
consumer = OAuth::Consumer.new(KEY, SECRET, { | |
:site=>"https://www.google.com", | |
:request_token_path=>"/accounts/OAuthGetRequestToken", | |
:authorize_path=>"/accounts/OAuthAuthorizeToken", |
This file contains 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
require 'rubygems' | |
require 'oauth' | |
KEY = "replace with your key" | |
SECRET = "replace with your secret" | |
consumer = OAuth::Consumer.new(KEY, SECRET, { | |
:site=>"https://www.google.com", | |
:request_token_path=>"/accounts/OAuthGetRequestToken", | |
:authorize_path=>"/accounts/OAuthAuthorizeToken", |
This file contains 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
# Heroku .gems file | |
oauth | |
nokogiri |
This file contains 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
nb: | |
activemodel: | |
errors: | |
messages: | |
taken: er allerede i bruk | |
mongoid: | |
errors: | |
messages: | |
document_not_found: |
This file contains 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
/* Generell plagsomhet */ | |
.skattesok2009 {display: none!important;} | |
#solBox {display: none!important;} | |
#header {display:none!important;} | |
div.ad {display: none!important;} | |
#ad-top {display: none!important;} | |
div#topp-ad {display: none!important;} | |
#tvguide .head {display: none!important; } | |
iframe {display: none!important;} | |
#footerwrapper {display: none!important;} |
This file contains 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
# An attempt at visualising classbox local rebinding as described in | |
# http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.3.4133&rep=rep1&type=pdf | |
# | |
# Suppose a classbox ClassBox1 defines a class C with two methods, m callin n, and | |
# classbox ClassBox2 imports C from ClassBox1 and replaces n. We say that… | |
class C;end | |
module ClassBox1 | |
refine C do |
OlderNewer