Skip to content

Instantly share code, notes, and snippets.

Sven Dunemann forelabs

Block or report user

Report or block forelabs

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
@forelabs
forelabs / ar_arel_wrapper.rb
Created Jan 9, 2020 — forked from tokland/ar_arel_wrapper.rb
Simple wrapper over arel
View ar_arel_wrapper.rb
require 'active_record'
require 'arel'
# Ruby-like syntax in AR conditions using the underlying Arel layer (Rails >= 3.0).
#
# What you would usually write like this:
#
# User.where(["users.created_at > ? AND users.name LIKE ?", Date.yesterday, "Mary"])
#
# can now be written like this (note those parentheses required by the operators precedences):
View .gitignore_global
.env
.npmrc
.ssh/
*.sqlite
*.log
node_modules/
@forelabs
forelabs / .gitconfig
Created Sep 25, 2019
global git config
View .gitconfig
[push]
default = tracking
[branch]
autosetuprebase = always
[alias]
c = commit
u = pull --rebase
p = push
dev = checkout development
new = checkout -b
@forelabs
forelabs / grmaster.bash
Created Sep 25, 2019
branch rebase master
View grmaster.bash
function grmaster() {
b=$(git branch | sed -n '/\* /s///p')
git checkout master
git pull --rebase
git checkout $b
git rebase master
}
@forelabs
forelabs / genpasswd.bash
Created Sep 25, 2019
password generator
View genpasswd.bash
function genpasswd() {
local l=$1
[ "$l" == "" ] && l=32
tr -dc "!$#;,.%()A-Za-z0-9_" < /dev/urandom | head -c ${l} | xargs
}
@forelabs
forelabs / update-go.bash
Created Sep 25, 2019
go version update
View update-go.bash
function update-go() {
release=$(curl --silent https://golang.org/doc/devel/release.html | grep -Eo 'go[0-9]+(\.[0-9]+)+' | sort -V | uniq | tail -1)
os=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(case "$(uname -m)" in i*) echo '386' ;; x*) echo 'amd64' ;; *) echo 'armv61'; esac)
curl --silent https://storage.googleapis.com/golang/$release.$os-$arch.tar.gz \
| sudo tar -vxz --strip-components 1 -C $(dirname $(dirname $(which go)))
}
@forelabs
forelabs / aws-login.bash
Created Sep 25, 2019
aws login function
View aws-login.bash
function aws-login() {
eval $(aws-mfa ecr get-login --no-include-email)
}
@forelabs
forelabs / disable_animations.js
Created Aug 30, 2018
[Rails] Disable css & jquery animations in Capybara tests with Chome running on Selenium
View disable_animations.js
var disableAnimationStyles = '-webkit-transition: none !important;' +
'-moz-transition: none !important;' +
'-ms-transition: none !important;' +
'-o-transition: none !important;' +
'transition: none !important;' +
'transition-property: none !important;' +
'-o-transition-property: none !important;' +
'-moz-transition-property: none !important;' +
'-ms-transition-property: none !important;' +
'-webkit-transition-property: none !important;' +
You can’t perform that action at this time.