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
module Kernel | |
# usage: | |
# require 'irb_drop' | |
# ...do some stuff... | |
# irb_drop(binding) # irb will open here with the current local variables | |
# ...continue doing stuff... | |
def irb_drop(context=nil, *argv) | |
require 'irb' | |
require 'pp' | |
require 'yaml' |
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 'openid' | |
require 'openid/consumer' | |
require "openid/store/filesystem" | |
require 'openid/extensions/sreg' | |
class LoginController < ApplicationController | |
def create | |
response = openid_consumer.begin(params[:openid_url]) | |
sregreq = ::OpenID::SReg::Request.new | |
sregreq.request_fields(["email"], true) |
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 'open-uri' | |
run lambda { |env| | |
request = Rack::Request.new(env) | |
clly_url = request.query_string.gsub("#.png", "") | |
clly_content = clly_url + "/content" | |
begin | |
clly_image = open(clly_content) | |
[302, {'Location'=> clly_content, 'Content-Type' => 'text/html'}, []] |
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
def get_field_type_for(kind) | |
types = { | |
"nr" => "number", | |
"tlf" => "number", | |
"telefon" => "number", | |
"nummer" => "number", | |
"merknad" => "text", | |
"notater" => "text", | |
"anmerkning" => "text" |
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
# encoding: utf-8 | |
require 'writeexcel' | |
string_utf8 = "øæaaø" | |
string_no_utf8 = "abc" | |
excel = WriteExcel.new("out.xls") | |
ws = excel.add_worksheet | |
ws.write("A1", string_utf8) |
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
num #instances #bytes class name | |
---------------------------------------------- | |
1: 2928092 281096832 org.apache.xmlbeans.impl.store.Xobj$AttrXobj | |
2: 2626335 252128160 org.apache.xmlbeans.impl.store.Xobj$ElementXobj | |
3: 1511986 103759936 [C | |
4: 88030 58879440 [B | |
5: 1070984 42839360 java.util.TreeMap$Entry | |
6: 1507961 36191064 java.lang.String | |
7: 1016018 32512576 org.apache.poi.xssf.usermodel.XSSFCell |
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
<TextView | |
android:layout_width="54dp" | |
android:layout_height="54dp" | |
android:fontFamily="@font/gjenbrowntt_regular" | |
android:text="1" | |
android:textSize="24sp" | |
android:includeFontPadding="false" | |
android:firstBaselineToTopHeight="24sp" | |
android:textColor="@color/black" android:background="@drawable/background_rounded_corners" | |
android:textSize="24sp" android:gravity="center" |