Skip to content

Instantly share code, notes, and snippets.

View murdho's full-sized avatar

Murdho Savila murdho

View GitHub Profile
@murdho
murdho / 0_reuse_code.js
Created November 30, 2013 13:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@murdho
murdho / rails_resources.md
Created November 30, 2013 13:24 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@murdho
murdho / gist:7719797
Created November 30, 2013 14:33 — forked from mattetti/gist:1015948
Some Excel formulas
module Excel
module Formulas
def pmt(rate, nper, pv, fv=0, type=0)
((-pv * pvif(rate, nper) - fv ) / ((1.0 + rate * type) * fvifa(rate, nper)))
end
def ipmt(rate, per, nper, pv, fv=0, type=0)
p = pmt(rate, nper, pv, fv, 0);
ip = -(pv * pow1p(rate, per - 1) * rate + p * pow1pm1(rate, per - 1))
(type == 0) ? ip : ip / (1 + rate)
require 'function'
# A fibonacci function.
fib = Function.new
fib[0] = 0
fib[1] = 1
fib[Integer] = proc { |i| fib[i - 2] + fib[i - 1] }
p fib[0] # => 0
# After building a new Linode Ubuntu 13.04 image...
ssh root@linode-123
# ...
uname -a
# Linux li348-235 3.12.9-x86_64-linode37 #1 SMP Mon Feb 3 10:01:02 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
apt-get update
apt-get install -y linux-virtual grub-legacy-ec2
@murdho
murdho / gist:7c42c3421cc1eff73510
Created January 6, 2015 12:39
nokogiri install
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 \
gem install nokogiri -v '1.6.1' -- \
--with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config \
--with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config

Keybase proof

I hereby claim:

  • I am murdho on github.
  • I am murdho (https://keybase.io/murdho) on keybase.
  • I have a public key whose fingerprint is 00F2 1B91 9FDD 9CA7 F90D 5008 A77F 6771 24C5 8921

To claim this, I am signing this object:

# Replace "#..." with something to make it return "something!"
# (please use Ruby 2.1 or newer)
something = #...
something.something unless something
# => "something!"
@murdho
murdho / trace.rb
Last active October 24, 2018 12:40
Show trace of method calls and returns (only project files)
@trace_depth = 0
@trace = TracePoint.new(:call, :return) do |tp|
if tp.path.include?("/murdho/Developer/APP_NAME_HERE")
is_a_call = tp.event == :call
is_a_call ? @trace_depth += 1 : @trace_depth -= 1
@trace_depth = 0 if @trace_depth < 0
puts [
" " * @trace_depth,
"\e[33m", # Yellow color start
@murdho
murdho / comment.md
Created February 13, 2019 20:39
Crystal macOS brew ld: library not found for -lssl [libssl-dev]

Crystal not working in Mac OS X Mojave #6875


**jasdeepsingh ** commented on 27 Sep 2018

Solution:

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig Fish Shell: set -U -x PKG_CONFIG_PATH /usr/local/opt/openssl/lib/pkgconfig