Skip to content

Instantly share code, notes, and snippets.

View emtee's full-sized avatar
💭
Coding

Amit Jangu emtee

💭
Coding
View GitHub Profile
@jakimowicz
jakimowicz / the % notation in ruby.md
Last active May 9, 2025 14:59
%Q, %q, %W, %w, %x, %r, %s, %I, %i

%Q, %q, %W, %w, %x, %r, %s, %i

Perl-inspired notation to quote strings: by using % (percent character) and specifying a delimiting character.

Any single non-alpha-numeric character can be used as the delimiter, %[including these], %?or these?, %~or even these things~.

Strings

% or %Q

@ankurk91
ankurk91 / install-node-js.sh
Last active November 4, 2024 05:29
Install node-js, npm and yarn on Ubuntu/Mac using nvm
#!/bin/sh
# Install node and npm via nvm - https://github.com/nvm-sh/nvm
# Run this script like - bash script-name.sh
# Define versions
INSTALL_NODE_VER=22
INSTALL_NVM_VER=0.40.1
@niksumeiko
niksumeiko / git.migrate
Last active July 1, 2025 18:41
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@emtee
emtee / maverick
Created November 21, 2012 19:07
Template for creating a new rails app with pre-configured active admin + necessary migration and associations. It relies on a yml file to find out the model related information. Checkout the demo yml file here https://gist.github.com/4127296
# rails new maverick -m https://raw.github.com/gist/4126950/ -d mysql
# rake rails:template LOCATION=https://raw.github.com/gist/4126950/
# <------ Pre-requisits ------>
# Setting current directory (for loading the yml config file)
@current_dir = Dir.pwd.gsub("/#{app_name}", "")
def ask_wizard(question)
ask "\033[1m\033[30m\033[46m" + "prompt".rjust(10) + "\033[1m\033[36m" + " #{question}\033[0m"
end
@riyad
riyad / bootstrap_breadcrumbs_builder.rb
Created February 28, 2012 17:38
How to make breadcrumbs_on_rails render a Bootstrap compatible breadcrumb navigation
# The BootstrapBreadcrumbsBuilder is a Bootstrap compatible breadcrumb builder.
# It provides basic functionalities to render a breadcrumb navigation according to Bootstrap's conventions.
#
# BootstrapBreadcrumbsBuilder accepts a limited set of options:
# * separator: what should be displayed as a separator between elements
#
# You can use it with the :builder option on render_breadcrumbs:
# <%= render_breadcrumbs :builder => ::BootstrapBreadcrumbsBuilder, :separator => "&raquo;" %>
#
# Note: You may need to adjust the autoload_paths in your config/application.rb file for rails to load this class: