Skip to content

Instantly share code, notes, and snippets.

View anoobbava's full-sized avatar
🎯
Focusing

Anoob Bava anoobbava

🎯
Focusing
View GitHub Profile
I reviewed some common Ruby methods and grouped them by behavior.
Hopefully this helps someone else too.
[Please copy paste and fix typos, add/delete, improve from this Gist.](https://gist.github.com/dirkdirk/9209d7ea67ac57543975162713910224)
-
# Array
@anoobbava
anoobbava / Collect_Select_Map_Inject_Reject_Detect.rb
Created August 4, 2017 05:54 — forked from vaichidrewar/Collect_Select_Map_Inject_Reject_Detect.rb
how to use collect or map or select or each or inject or reject Or when to use each vs collect vs map vs select vs each vs inject vs reject
map and collect are same http://stackoverflow.com/questions/5254732/difference-between-map-and-collect-in-ruby
http://matthewcarriere.com/2008/06/23/using-select-reject-collect-inject-and-detect/
1. Use select or reject if you need to select or reject items based on a condition.
2. Use collect if you need to build an array of the results from logic in the block.
3. Use inject if you need to accumulate, total, or concatenate array values together.
4. Use detect if you need to find an item in an array.
@anoobbava
anoobbava / post-merge
Created November 17, 2017 01:18 — forked from GianlucaGuarini/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

It looks as though using Release Phase commands (available as of 2 June 2016) is the preferred way of running things like migrations after the slug has been compiled and deployed.

The Buildpack API explicitly suggests avoiding side effects during the build:

Buildpack developers should avoid generating side effects during the build. For example, it is not recommended to perform database migrations in the compile script.

The following example creates a Rails app with a single migration and demonstrates that the migration is run after deployment.

# Create empty Rails app
@anoobbava
anoobbava / Octopress Blogging
Last active April 3, 2018 09:46 — forked from og-shawn-crigger/Octopress Blogging
A note for Octopress
===Install Octopress===
git clone git://github.com/imathis/octopress.git
cd octopress
gem install bundler rake --no-rdoc --no-ri
bundle install
rake install
===Start Blogging===

To compress a folder

tar -zcvf tar-archive-name.tar.gz source-folder-name

To un-compress a tar.gz

tar -zxvf tar-archive-name.tar.gz

@anoobbava
anoobbava / MySQL_macOS_Sierra.md
Created April 19, 2018 15:22 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@anoobbava
anoobbava / rm_mysql.md
Created April 19, 2018 15:23 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql