Skip to content

Instantly share code, notes, and snippets.

View jakubpawlowicz's full-sized avatar

Jakub Pawlowicz jakubpawlowicz

View GitHub Profile
@jakubpawlowicz
jakubpawlowicz / inGroupsOf.js
Created May 5, 2010 13:28
MooTools Array inGroupsOf method. Returns array of arrays grouped by <size> elements.
Array.implement({
inGroupsOf: function(size) {
var slices = [];
var current = [];
this.each(function(e) {
if (current.length < size) current.push(e);
else {
slices.push(current);
current = [e];
}
@jakubpawlowicz
jakubpawlowicz / wait_for_xpath_count.rb
Created June 7, 2010 15:32
RSelenese helper for asserting xpath count
def wait_for_xpath_count(xpath, expected)
command 'waitForXpathCount', xpath, expected
end
Capybara.register_driver :custom_firefox do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile['dom.max_script_run_time'] = '60'
Capybara::Driver::Selenium.new(app, browser: :firefox, profile: profile)
end
@jakubpawlowicz
jakubpawlowicz / capistrano current branch
Created October 6, 2010 17:37
Allows deploying current branch via Capistrano without altering deployment configuration on every branch
set :branch, `git branch 2> /dev/null`.scan(/\* (\S+)/).flatten[0]
@jakubpawlowicz
jakubpawlowicz / Vagrantfile
Created January 6, 2015 12:25
Vagrantfile template for a higher performant VM
Vagrant.configure('2') do |config|
config.ssh.forward_agent = true
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--memory', '2048']
vb.customize ['modifyvm', :id, '--cpus', 4]
vb.customize ['modifyvm', :id, '--ioapic', 'on']
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'off']
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'off']
end
@jakubpawlowicz
jakubpawlowicz / gist:6fa7465b323486e8b89d
Created February 22, 2015 16:22
Regex matching single- and multiline CSS comments in Sublime Text
/\*((?!\*/).|\n)+\*/
@jakubpawlowicz
jakubpawlowicz / Dockerfile
Created March 1, 2015 22:36
Docker + CentOS 7 + Rubinius 2.2.10
FROM centos:7
ENV RBX_VERSION 2.2.10
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV HOME /root
ENV SHELL /bin/bash
@jakubpawlowicz
jakubpawlowicz / brunch.js
Created June 6, 2016 11:04
Brunch setup to output more than one CSS and JS file
exports.config = {
files: {
javascripts: {
joinTo: {
'js/app.js': [
'web/static/js/vendor/**/*.js',
'web/static/js/app/*.js'
],
'js/dashboard.js': [
'web/static/js/vendor/**/*.js',
@jakubpawlowicz
jakubpawlowicz / configuration.nix
Created December 5, 2018 14:40
How to add brotli module to nginx under NixOS
{ config, pkgs, ... }:
{
nixpkgs.overlays = [
(self: super: {
nginxStable = super.nginxStable.override {
modules = [
self.nginxModules.brotli
];
};
---
layout: default
title: Terms & Conditions
body_class: terms
---
<section class='section content'>
<div class='container group'>
<h1 class='motto'>Terms of service</h1>
<div class='full'>