Skip to content

Instantly share code, notes, and snippets.

Remote working

Germany specifics

Germany is 9 hours ahead (12am in AZ = 9am in Germany).

  • Available/awake times for me would be 12am-1:30pm az time (9am-10:30pm Germany)
  • Work 75% of time in morning/afternoon
  • Work/save 6-7pm (9-10am AZ time) for general standup and catch up at our normal time
@wejrowski
wejrowski / rspec-guides.markdown
Last active August 29, 2015 13:58
Rspec guides notes

General guides

  • Use describe blocks for objects and methods ("given" scenarios)
  • Use context blocks for "when" scenarios
  • Avoid spec descriptions longer than 40 characters. Split into contexts if longer.
  • Prefer expect syntax
  • Use before blocks at the lowest scope necessary
    • e.g. start within it blocks, then move into describe, then only if necessary for all tests put outside of those.
  • Use validation tests and place them at the top of the describe block
@wejrowski
wejrowski / willen-zum-leben
Last active August 29, 2015 14:11
Die Begründung des Optimismus aus dem Willen zum Leben
Zwei Dinge hat das Denken zu leisten: uns aus der naiven zur vertiefen Welt-
und Lebensbejahung zu füren und uns von ethischen Regungen zu einer
denknotwendigen Ethic gelangen zu lassen.
Vertiefe Welt- und Lebensbejahung besteht darin, dass wir den Willen haben,
unser Leben und alles durch uns irgendwie beeinflussbare Sein zu erhalten und
auf seinen höchsten Wert zu bringen. Sie verlangt von uns, dass wir alle
Ideale der materiellen und geistigen Vervollkommnung des Menschen, der
Gesellschaft und der Menschheit denken und uns durch sie zu stetem Wirken und
stetem Hoffen bestimmen lassen. Sie erlaubt uns nicht, uns auf uns selber
@wejrowski
wejrowski / gist:ac4594ce5d4d6e3357ba
Created January 29, 2015 01:33
Gmail api Javascript client execution
/*
Gmail Client (ideas)
Usage:
var gmailClient = newGmailClient(myAccessToken);
var response = gmailClient.execute({
url: "users/me/messages",
headers: {},
@wejrowski
wejrowski / gist:0e7d096151e0ca02a020
Created February 12, 2015 17:40
VIM - remove all multiline comments
:%s/\/\*\{-1}\_.\{-}\*\///g
@wejrowski
wejrowski / es5-6.js
Last active September 15, 2015 18:19
JS select comparisons
var params = { t: 123, type: 'mytype', channelId: 'mychan', badge:'thebadge' };
var allowedPersonParams = ["type", "channelId", "badge", "since", "until"];
// ES5
var result = {};
allowedPersonParams.forEach(function (paramName) {
if (currentParams[paramName]) {
result[paramName] = currentParams[paramName];
}
var input = [[2,6],[3,5],[7,21],[20,21]];
var expectedOutput = [[2,6],[7,21]];
var rangesOverlap = function(range1, range2) {
return (
(range1[1] >= range2[0] && range1[1] <=range2[1]) ||
(range1[0] <= range2[0] && range1[1] >= range2[0])
);
};
@wejrowski
wejrowski / path-val.js
Last active October 28, 2015 19:10
Get path value
// via http://www.redotheweb.com/2015/09/18/declarative-imperative-js.html
function getValue(object, propertyName) {
if (!propertyName) throw new Error('Impossible to set null property');
return typeof object === 'undefined' ? undefined : object[propertyName];
}
function getNestedValue(object, propertyName) {
return propertyName.split('.').reduce(getValue, object);
}
@wejrowski
wejrowski / css_urlstrip.rb
Last active December 15, 2015 01:59
CSS image parser
urls = ""
DATA.each do |l|
img = l[/url\([^)]*\)/]
urls << "<img src=#{img.gsub(/url\(([^)]*)\)/, '\1')} /><hr />\n" if img
end
f = File.open("urltest.html", "w") {|file| file.truncate(0) } # Clear file contents
f = File.open("urltest.html", "w")
f.write urls
f.close
@wejrowski
wejrowski / rails_tests_in_isolation.rb
Created August 21, 2013 23:42
Run all rails tests in isolation
require 'benchmark'
require 'socket'
ENV["RAILS_ENV"] = "test"
# Add test folder to load path
$: << './test'
puts Benchmark.measure{
# Assuming test_helper requires config/environment