Skip to content

Instantly share code, notes, and snippets.

View pawurb's full-sized avatar

Paweł Urbanek pawurb

View GitHub Profile
@pawurb
pawurb / application.rb
Created February 23, 2020 12:20
Rails colored prompt without gems
# config/application.rb
module RailsApplicationName
class Application < Rails::Application
...
console do
ARGV.push "-r", root.join("lib/console.rb")
end
end
end
@pawurb
pawurb / focus.sh
Created August 7, 2016 13:20
block nasty sites
echo '##############
0.0.0.0 www.reddit.com
:: www.reddit.com
#############' >> /etc/hosts
@pawurb
pawurb / gist:f53606eb4c8d3ae4a288
Created June 10, 2015 19:48
couchDB cors settings
cors
credentials true
headers accept, authorization, content-type, origin, referer, x-csrf-token
methods GET, PUT, POST, HEAD, DELETE
origins *
couch_httpd_auth
require_valid_user true
@pawurb
pawurb / gist:8a1cba564cca81ac6a23
Created November 8, 2014 19:01
colors changer
let colors = [UIColor.turquoiseColor(),
UIColor.greenSeaColor(),
UIColor.emerlandColor(),
UIColor.nephritisColor(),
UIColor.peterRiverColor(),
UIColor.belizeHoleColor(),
UIColor.amethystColor(),
UIColor.wisteriaColor(),
@pawurb
pawurb / settings
Created July 29, 2014 11:56
simple settings
file_content = File.open File.join(Rails.root, 'config', 'settings.yml')
Settings = OpenStruct.new(YAML.load(file_content)[Rails.env])
@pawurb
pawurb / gist:378c26d165b5c41747ba
Last active August 29, 2015 14:02
trying out swift
// Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
var dictionary = [1 : "1",2 : "2" ,3 : "3"]
for (a , b) in dictionary {
println(String(a) + b)
}
@pawurb
pawurb / gmailDelayed.js
Created October 9, 2013 12:39
Fighting email checking addiction ...
//TODO
//https://developers.google.com/apps-script/managing_triggers_programmatically
function moveDelayedMessages() {
receiveEmails("Delayed Messages");
}
// receiveEmails() will take all threads in labelname (Default: 'Delayed messages')
// and place them into the mailbox. The intent is for a delayed retrieval of
@pawurb
pawurb / ruby_mix.rb
Last active December 24, 2015 09:19
Ruby mixed ideas
#Metaprogramming
class Meta
def create_method(name, block)
self.class.send(:define_method, name, block)
end
end
m = Meta.new
method_body = -> { puts "hello no args" }
another_method_body = lambda { |text| puts "args are: #{text}" }