[ -z "\2" ] && /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea \1 || /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea --line \2 \1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r=rand;(1..9).map{|n|Math.log10(1+1.0/n)}.inject([]){|a,e|a+[(a[-1]||0)+e]}.map.with_index{|p,i|[i+1,p]}.find{r<_2}[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ary.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby --dump version | |
ruby --dump copyright | |
ruby --dump usage #?? | |
ruby --dump yydebug file.rb | |
ruby --dump syntax file.rb | |
ruby --dump parsetree file.rb | |
ruby --dump parsetree_with_comment file.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* go to https://elgoog.im/breakout/ and run the snippet in your js console (works only for one level): */ | |
hit = function($) { $('#breakout-paddle').style.left = (parseInt($('#breakout-ball').style.left, 10)-50).toString()+'px'; window.setTimeout(function(){ hit($); }, 10)}; hit($); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git remote prune origin && git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install a custom MySQL 5.7 version - https://www.mysql.com | |
# | |
# To run this script on Codeship, add the following | |
# command to your project's setup commands: | |
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/mysql-5.7.sh | bash -s | |
# | |
# Add the following environment variables to your project configuration | |
# (otherwise the defaults below will be used). | |
# * MYSQL_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mac OS X: | |
script -q colored_word_diff.txt git diff --word-diff | |
cat colored_word_diff.txt|ansi2html > colored_word_diff.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Sort your rails locale yamls alphabetically and adds an empty line when indent lowers 2 or more levels | |
# Prints everything to stdout. Watch your yaml anchors and aliases (fix manually, if needed). | |
# usage: | |
# chmod +x ./locale_yaml_formatter.rb | |
# ./locale_yaml_formatter.rb <path/to/locale.yml> | |
# | |
# In a rails project, run | |
# find . -type f -name *.yml | grep -v spec | grep locales | _ |