Skip to content

Instantly share code, notes, and snippets.

View djanowski's full-sized avatar

Damian Janowski djanowski

View GitHub Profile
@djanowski
djanowski / .000-README
Last active January 25, 2016 18:37
Babel bug with `this` inside async arrow function - npm i && npm test
babel-preset-stage-2 pulls in the newest version of babel-plugin-transform-async-to-generator,
however the async arrow function still has `this` = `undefined`.
If I manually install babel-plugin-transform-async-to-generator and add it to the list of plugins
in .babelrc, everything works as expected.
Steps to reproduce:
$ npm install && npm test
require "hmote"
class Page
include HMote::Helpers
attr_accessor :path
attr_accessor :layout
attr_accessor :params
def initialize(path, layout = nil)
module Syro::Render
HTML = "text/html; charset=utf-8".freeze
TEMPLATES = {}
def page(path)
template(path, "layout")
end
def template(path, layout = nil)
TEMPLATES[[path, layout]] ||= begin
git clone https://gist.github.com/djanowski/cfc662d64585b284db9c disque-crash
cd disque-crash
make
@djanowski
djanowski / backtrace.rb
Created March 4, 2015 01:07
Simple Ruby backtrace filtering
# Hook it up to your favorite testing framework:
#
# module MiniTest
# def self.filter_backtrace(bt)
# Backtrace.filter(bt)
# end
# end
module Backtrace
NOISE = Gem.path + $LOAD_PATH
#!/bin/sh
#
# Adam Sharp
# Aug 21, 2013
#
# Usage: Add it to your PATH and `git remove-submodule path/to/submodule`.
#
# Does the inverse of `git submodule add`:
# 1) `deinit` the submodule
# 2) Remove the submodule from the index and working directory
@djanowski
djanowski / gist:d7c396d171dd1f9ae76b
Created November 8, 2014 20:26
HMote with Cuba::Mote
# cuba/mote tries to require mote, but we already
# provide hmote.
$LOADED_FEATURES << "mote.rb"
require "hmote"
require "cuba/mote"
git checkout master
git gc
git remote | while read remote; do
git remote prune $remote
done
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
#! /bin/bash
# Creates passwords of the given length, all lower case for easier input on mobile devices.
length="${1:-24}"
password=$(openssl rand -base64 $(($length + 50)) | tr -Cd '[:lower:]' | cut -c 1-$(($length)))
echo "$password" | pbcopy
echo "$password"
cat $1 |
tr '[:upper:]' '[:lower:]' |
sed -e 's/^\.//' |
sed -e 's/\.con$/.com/' |
sed -e 's/\.con\.ar$/.com.ar/' |
sed -e 's/^www//' |
sed -e 's/^\+//' |
sed -e 's/@@/@/' |
sort |
uniq |