Skip to content

Instantly share code, notes, and snippets.

Damian Janowski djanowski

Block or report user

Report or block djanowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View page.rb
require "hmote"
class Page
include HMote::Helpers
attr_accessor :path
attr_accessor :layout
attr_accessor :params
def initialize(path, layout = nil)
View gist:77b05564376970d08cc1
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
View 00-INSTRUCTIONS
git clone https://gist.github.com/djanowski/cfc662d64585b284db9c disque-crash
cd disque-crash
make
@djanowski
djanowski / backtrace.rb
Created Mar 4, 2015
Simple Ruby backtrace filtering
View backtrace.rb
# 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
View git-remove-submodule
#!/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
View gist:d7c396d171dd1f9ae76b
# cuba/mote tries to require mote, but we already
# provide hmote.
$LOADED_FEATURES << "mote.rb"
require "hmote"
require "cuba/mote"
View git-spring-cleaning
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
View newpass
#! /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"
View filter-emails
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 |
@djanowski
djanowski / missing-requires.sh
Created Apr 14, 2014
Find your missing requires in shotgun.rb
View missing-requires.sh
everywhere=$(ag '^\s*require' -w --ruby --no-numbers --ignore=test/ --ignore=tasks/ --ignore=scripts/ | awk -F: '{gsub(/^ */, "", $2); print $2}' | sort | uniq)
shotgun=$(ag '^\s*require' -w --no-numbers shotgun.rb)
echo "$everywhere" | grep -v -f <(echo "$shotgun")
You can’t perform that action at this time.