Skip to content

Instantly share code, notes, and snippets.

Working from home

Shiva Bhusal shivabhusal

Working from home
Block or report user

Report or block shivabhusal

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
shivabhusal / clipboard.history.json
Last active Dec 30, 2018
Visual Studio Code Settings Sync Gist
View clipboard.history.json
"version": 2,
"clips": [
"value": "Date.yesterday.to_s",
"createdAt": 1546148589178,
"copyCount": 1,
"useCount": 0,
"language": "ruby",
"createdLocation": {
shivabhusal /
Created Sep 5, 2017
Installation of OhMyZSH in linux ubuntu/mint
sudo apt-get install zsh
sh -c "$(wget -O -)"
echo "ZSH_THEME=\"agnoster\"" >> ~/.zshrc
cd ~/ && wget
sudo cp ~/PowerlineSymbols.otf /usr/share/fonts/truetype/
shivabhusal / application_helper.rb
Created Aug 25, 2017
Rails : Server separate images in production and development environment
View application_helper.rb
module ApplicationHelper
# It hijacks the methods
[:image_tag, :image_path, :image_url].each do |m_name|
define_method(m_name) do |*arg|
rescue Sprockets::Rails::Helper::AssetNotFound
arg[0] = "#{Rails.env}/#{arg[0]}"
View db_import.rb
require 'date'
Tables = [
View _colors.scss
$colors: aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkturquoise darkviolet deeppink deepskyblue dimgray dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightpink lightsalmon lightseagreen lightskyblue lightslategray lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace
View chartjs.slim
$(function () {
Chart.elements.Line.prototype.draw = function () {
var blackColor = 'rgba(0, 0, 0, 1)';
var redColor = 'rgba(255, 0, 0, 1)';
var scale = this.scale
// draw lines
var points = this._chart.getDatasetMeta(0).data;
shivabhusal / template.rb
Created Jul 9, 2017
A Rails template to generate config/database.yml files for specific database like `mysql` , `sqlite`, `pg`. You may fork it and add support for other databases as well
View template.rb
# ------------------- MySQL -------------------------------
default: &default
adapter: mysql2
encoding: utf8
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
<% if mysql_socket %>
socket: <%= mysql_socket %>
shivabhusal / test_setup_and_gem_install_template.rb
Last active Apr 16, 2019
A Rails template for generating boilerplate configs for any new Rails app; viz. rspec, factory_girl_rails, db-cleaner,annonote etc are preconfigured. It saves me an hour everytime.
View test_setup_and_gem_install_template.rb
gem 'slim-rails'
gem 'sassc-rails'
gem 'any_login'
gem 'active_model_serializers', '~> 0.10.0'
gem 'responders'
gem_group :development do
gem 'annotate'
shivabhusal / find_bug.rb
Last active Jun 27, 2017
Run this code in your machine and find the bug
View find_bug.rb
class Roulette
def method_missing(name, *args)
person = name.to_s.capitalize
3.times do
number = rand(10) + 1
puts "#{number}..."
"#{person} got a #{number}"
shivabhusal / include_class.rb
Last active Jun 23, 2017
Ruby creates an anonymous class with the name of the module you are including and puts it in the ancestors chain.
View include_class.rb
module Printable
def print(message)
puts message
class Animal
include Printable
def speak
You can’t perform that action at this time.