Skip to content

Instantly share code, notes, and snippets.


Ain Tohvri ain

View GitHub Profile
ain /
Created Nov 19, 2018
Check last commit message for [hotfix]
if [[ `git log -1 --pretty=%B` == *"[hotfix]"* ]]; then
echo "HOTFIX!"
echo "NOT HOTFIX!"
ain / wp-importer.rb
Created Jul 17, 2016
Wordpress data Import script for Jekyll 3
View wp-importer.rb
require "jekyll-import"{
"source" => "wp-export.xml"
ain / seed_migrate.patch.rake
Created Nov 10, 2014
Rake task to patch seed_migrate table reset failure on db:reset
View seed_migrate.patch.rake
# Call with rake app:db:reset
namespace :app do
namespace :db do
# Patches seed_migration issue #22
desc "Reset database incl. seeding migration"
task :reset => :environment do
puts "Resetting database..."
ain / cssmin-font-family-regex.js
Created Feb 3, 2014
Regex for matching the font name within minified CSS class definition.
View cssmin-font-family-regex.js
ain /
Last active Sep 25, 2020
JavaScript compare() method for Array
View = function(array) {
if (!array) {
return false;
if (this.length !== array.length) {
return false;
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] instanceof Array && array[i] instanceof Array) {
if (!this[i].compare(array[i])) {
ain /
Created Dec 5, 2013
Release folder cleanup script for Capistrano-like folder structure
# Check for Bash config
# On FreeBSD/OS X GNU ls is required for -v option
if [ -f ~/.bashrc ]; then
shopt -s expand_aliases
source ~/.bashrc
ain / email-regex.js
Last active Dec 28, 2015
Email validation regex for emails likely to be used in Germany.
View email-regex.js
var emailRegex = /^([\wäöüÜÖÄß])+(([\.]{0,1}[\wäöüÜÖÄß])?)*(([\+]{0,1}[\wäöüÜÖÄß])?)*([\wäöüÜÖÄß-])*\@([\wäöüÜÖÄß-]+\.)+([\w]{2,})+$/;
ain / Keyboard-et.plist.part
Last active Dec 26, 2015
Mapping for for selecting special characters on press and hold Q key on Mac.
View Keyboard-et.plist.part
<string>` ^ ° • ★ “ ”</string>
<string>` ^ ° • ★ “ ”</string>
ain / poster.php
Created Aug 23, 2013
PHP dummy parsing the REQUEST.
View poster.php
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<pre><?php print_r($_REQUEST); ?></pre>
ain / netbeans_ignore.regex
Last active Dec 18, 2015
Regex for Netbeans' Ignored Files Pattern to make Travis CI dotfile visible
View netbeans_ignore.regex