Skip to content

Instantly share code, notes, and snippets.

View enajski's full-sized avatar

Wojciech Franke enajski

View GitHub Profile
@enajski
enajski / hooks.rb
Created February 11, 2013 12:35
Bind pry to inspect failing cucumber steps in development.
require 'pry'
After( '@developing' ) do |scenario|
binding.pry if scenario.failed?
end
@enajski
enajski / hooks.rb
Last active December 13, 2015 16:58
require 'pry'
require 'calabash-cucumber/launch/simulator_helper'
require 'sim_launcher'
After( '@developing' ) do |scenario|
binding.pry if scenario.failed?
end
After do |scenario|
if scenario.failed?
{
"bold_folder_labels": true,
"caret_style": "phase",
"font_size": 15.0,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"scroll_past_end": true,
@enajski
enajski / csv-generator.rb
Created August 28, 2013 09:55
Faker CSV generator, courtesy of @yapee I think.
require 'faker'
modules = [Faker::Name, Faker::Company, Faker::Address, Faker::PhoneNumber, Faker::Internet]
puts modules.map { |x| x.methods(false).map { |y| "#{x.to_s.gsub("Faker::", "")} #{y}"} }.flatten.join(',')
data = (0...ARGV[0].to_i).map do
modules.map { |x| x.methods(false).map { |y| x.send(y) if x.method(y).arity < 1} }.flatten.join(',')
end
puts data.join("\n")
@enajski
enajski / base_cf_docs.md
Last active September 26, 2016 15:56
Documentation for Base CRM custom fields
@enajski
enajski / randomize_time_field
Created March 3, 2014 11:32
Update last_activity_date with random times
def make_random_time
date1 = Time.new
date2 = Time.new - 50000000 # Beginning of time range
Time.at((date2.to_f - date1.to_f) * rand + date1.to_f).to_s
end
contacts = Contact.where(...)
contacts.each { |contact| contact.update_attribute(:last_activity_date, make_random_time) }
@enajski
enajski / Preferences.sublime-settings
Created June 17, 2014 12:55
Sublime Text 3 user config
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/Espresso Libre.tmTheme",
"font_face": "Menlo",
"font_size": 19,
"highlight_line": true,
"ignored_packages":
[
"Vintage",
def taci
sample :loop_amen, start: 0.75, finish: 1, rate: 1.5
end
def cita
sample :loop_amen, start: 0.5, finish: 0.75, rate: 1.5
end
def puci
sample :loop_amen, start: 0.0, finish: 0.25, rate: 1.5
@enajski
enajski / min-char-rnn.py
Created November 11, 2018 21:46 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)