Skip to content

Instantly share code, notes, and snippets.

@valakirka
valakirka / banana_bread.md
Last active September 17, 2022 15:47
Banana bread

Banana bread

Ingredients

  • 3 very ripe bananas
  • 2 eggs
  • 220gr brown sugar
  • 8 tbsp butter
  • 250gr flour
  • 1 tsp backing powder
  • 1 tsp backing soda
  • A handful of chopped walnuts
@valakirka
valakirka / torrijas.md
Created May 12, 2017 06:52
Torrijas' recipe

Ingredients

  • One long 2-day-stale bread loaf (baguette will do)
  • Milk (at least 1/2 liter)
  • Lemon zest
  • Cinnamon stick
  • 1/2 vanilla bean
  • 1/2 glass of anís dulce (this is hard to find in Berlin, but spotted at Mite Meer)
  • 3 eggs
before 'deploy', 'deploy:good_luck'
before 'deploy:migration', 'deploy:good_luck'
task :good_luck, roles: :app, except: { no_release: true } do
if Time.now.wday == 5
logger.debug('')
logger.debug('┓┏┓┏┓┃')
logger.debug('┛┗┛┗┛┃\○/')
logger.debug('┓┏┓┏┓┃ / Friday')
logger.debug('┛┗┛┗┛┃ノ)')
irb(main):020:0> require 'benchmark'
=> false
irb(main):021:0>
irb(main):022:0* params = {'platform' => 'ios'}
=> {"platform"=>"ios"}
irb(main):023:0>
irb(main):024:0* Benchmark.bm do |x|
irb(main):025:1* x.report { platform = params['platform'].is_a?(Array) ? params['platform'].first : params['platform']; puts platform }
irb(main):026:1> x.report { platform = Array === params['platform'] ? params['platform'].first : params['platform']; puts platform }
irb(main):027:1> x.report { platform = Array(params['platform']).first; puts platform }
@valakirka
valakirka / gist:9971138
Created April 4, 2014 09:26
Bash prompt git branch
# Show active Git branch #
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
# Example of prompt, full reference -> http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html #
export PS1="\u@\h:\w\$(git_branch)$ "
#----------------------------------PLEASE NOTE--------------------------------#
#This file is the author's own work and represents their interpretation of the#
#song. You may only use this file for private study, scholarship, or research.#
#-----------------------------------------------------------------------------#
Date: Wed, 31 May 1995 08:54 +1200 (NZST)
Subject: tab : Aubade - Bartoli
Aubade - Bartoli
~~~~~~
Estudio 6
~~~~~~~~~
By: Leo Brouwer (1939-)
Transcribed from: "Portrait" by Kavi
Transcribed and tabbed by: John Kean
Standard tuning.
6/4 time, changing to 4/4 near the end.
Allegro (MM = 138).
@valakirka
valakirka / post.rb
Created August 7, 2012 16:54
Sphinx scope
class Contents::Post < Contents::Base
has_many :content_members, :as => :memberable, :dependent => :destroy
has_many :members, :through => :content_members, :class_name => "Contents::Member"
belongs_to :kt_blog, :class_name => 'Kontent::KtBlog', :touch => true
has_many :blog_categories, :through => :kt_blog, :class_name => "Kontent::KtBlogCategory"
validates_presence_of :title
validates_presence_of :summary, :unless => Proc.new {|post| post.body.present?}
validates_presence_of :kt_blog_id
@valakirka
valakirka / example.rb
Created May 18, 2012 16:33
Indexes and custom sphinx_select searches
class NewsEntry < AR::Base
has_one :association
define_index do
index wadus
has association.published_at, :as => :published_at
end
end
@valakirka
valakirka / ckeditor_helper.rb
Created February 24, 2012 16:54
CKEDITOR re-configuration from view
def ckeditor_textarea(object, field, options = {})
options = options.dup.symbolize_keys
var = options.delete(:object) if options.key?(:object)
var ||= @template.instance_variable_get("@#{object}")
value = var.send(field.to_sym) if var
value ||= options.delete(:value) || ""
element_id = options.delete(:id) || ckeditor_element_id(object, field, options.delete(:index))