Skip to content

Instantly share code, notes, and snippets.

View pewniak747's full-sized avatar

Tomasz Pewiński pewniak747

View GitHub Profile
@pewniak747
pewniak747 / gist:2780469
Created May 24, 2012 09:36
capybara subdomains helper
Capybara.javascript_driver = :webkit
Capybara.server_port = 7171
def with_subdomain subdomain
old_subdomain = Capybara.app_host
Capybara.app_host = "http://#{subdomain}.localhost.dev:7171"
yield
ensure
Capybara.app_host = old_subdomain
end
@pewniak747
pewniak747 / post-receive-pivotal
Created April 10, 2012 15:57
git post-receive pivotal hook
#!/usr/bin/env ruby
# encoding: UTF-8
require 'net/http'
require 'nokogiri'
class GitLogs
attr_accessor :raw_log, :logs
def initialize old_ref, new_ref
self.raw_log = `git log --no-color --format=short #{old_ref}..#{new_ref}`.force_encoding('utf-8')
#include <iostream>
#include <vector>
int main() {
int szala1, szala2 = 0;
long mnoznik = 1;
std::vector<int> s1, s2;
std::cin >> szala1;
while(szala1 != szala2) {
if((szala1%3+1)%3+1 == (szala2%3+1)%3) {
#include<iostream>
int main() {
int data[100][2];
int p[100];
int howmany, mass;
std::cin >> howmany >> mass;
for(int i=0; i<=mass; i++) p[i] = 0;
/* classic boyer_moore find algorithm
* by pewniak747@gmail.com */
#include<iostream>
int boyer_moore(std::string input, std::string pattern) {
int index = 0;
int input_length = input.size()-1;
int pattern_length = pattern.size()-1;
int last[255];
#!/usr/bin/ruby
# tweet is a script that allows you to update
# your twitter status using shell
# written by Tomasz 'pewniak747' Pewiński
# pewniak747@gmail.com
def exp_value input
input[input.index("=")+1, input.size].strip
end