Skip to content

Instantly share code, notes, and snippets.

View ciembor's full-sized avatar

Maciej Ciemborowicz ciembor

View GitHub Profile
test:
override:
- bundle exec rake knapsack:rspec:
parallel: true
- bundle exec rake knapsack:cucumber_record_failing:
parallel: true
- bundle exec rake knapsack:cucumber_rerun:
parallel: true
# we don't have knapsack in our :production gems group, so the deploy would fail without this condition
if Rails.env.development? || Rails.env.test?
require 'knapsack'
# we have multiple nodes, so we need different files for each node
def failing_scenarios_filename
"failing_scenarios_#{ENV['CIRCLE_NODE_INDEX']}.txt"
end
namespace :knapsack do
module MyModule
@converter = Converter.new(:json)
class << self
def format=(format)
@converter.format = format
end
end
end
// config.js
var watcher = new TimeWatcher();
var refresh = new RefreshAction();
watcher.onPeriod(5, refresh);
// auster.js
var FsWatcher = require('./watchers/FsWatcher.js');
@ciembor
ciembor / gist:4751901
Created February 11, 2013 01:40
Callback hell.
function refresh() {
chrome.windows.getAll(function(windows) {
for (var i = 0; i < windows.length; i++) {
chrome.tabs.getAllInWindow(windows[i].id, function(tabs) {
chrome.storage.sync.get('active', function(object) {
if (object.active !== undefined) {
for (var j = 0; j < tabs.length; j++) {
if (-1 !== object.active.indexOf(tabs[j].url)) {
chrome.tabs.reload(tabs[j].id);
}
@ciembor
ciembor / switch.py
Created January 22, 2013 11:08
Switching between Python 3 and 2 in a runtime
#!/usr/bin/env python
import sys, os
print(sys.version_info[:])
if sys.version_info[0] != 2:
sys.argv.insert(0, "python2")
os.execl("/usr/bin/env", "/usr/bin/env", *sys.argv)
@ciembor
ciembor / robot.js
Created December 4, 2012 06:25 — forked from fabiopimentel/robot.js
[CAELUM TEAM]Megatron
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
@ciembor
ciembor / retotwe.py
Created November 24, 2012 00:09
Shows retweets to tweets ratio.
# -*- coding: utf-8 -*-
# https://github.com/ryanmcgrath/twython
from twython import Twython
# get your keys: https://dev.twitter.com/apps/new
t = Twython(app_key='jwh(...)PnQ',
app_secret='G2H(...)kSs',
oauth_token='284(...)Ytv',
oauth_token_secret='n8w(...)3Kk')
@ciembor
ciembor / gist:3615130
Created September 4, 2012 00:09
opłacalność optymalizacji
założenia:
mój czas jest wart tyle samo co czas osób, które go używają
dane:
delta_t - różnica czasu jednorazowego użycia kodu przed i po optymalizacji
x - prognozowana liczba użyć kodu
y - czas poświęcony na zoptymalizowanie kodu
z - prognozowana strata czasu podczas przyszłego rozwoju aplikacji
opłacalność = x * delta_t / (y + z)
@ciembor
ciembor / gist:3591685
Created September 1, 2012 23:56
Organizing time before an exam:)
#!/bin/bash
counter=1
while true; do
espeak -p10 -s160 "question ${counter}"
counter=`expr 1 + $counter`
sleep 600
done