Skip to content

Instantly share code, notes, and snippets.

View mohnish's full-sized avatar
🐢
slow and steady

Mohnish Thallavajhula mohnish

🐢
slow and steady
View GitHub Profile
@mohnish
mohnish / modules.js
Created April 9, 2017 19:32 — forked from tj/modules.js
import React from 'react' // export default React
import React, Component from 'react' // first is default, followed by exported
import foo from 'lib' // no default, so just grab all exports
// Maybe there's some reasoning behind the other choices regarding static analysis but
// most of the otheres seem unnecessary. Alternatively just using the destructuring syntax
// would be pretty nice and easier to remember.
@mohnish
mohnish / fixconsolas
Created February 8, 2017 09:31 — forked from evocateur/fixconsolas
Fix Consolas's line-height on OS X
#!/bin/bash
#
# Requires ftxdumperfuser from http://developer.apple.com/textfonts/download/
#
# Usage: fixconsolas [files ...]
# When called with no arguments, it attempts to operate on every TrueType
# file in the current directory.
#
# References:
# http://bandes-storch.net/blog/2008/12/21/consolas-controlled/#comment-2042
@mohnish
mohnish / README.md
Created July 31, 2016 21:18 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@mohnish
mohnish / README.md
Created July 13, 2016 18:21 — forked from joshdover/README.md
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

@mohnish
mohnish / bechmark_md5_sha1.rb
Created June 3, 2016 18:50
benchmark md5, sha1 on ruby 1.8.7
require 'benchmark/ips'
require 'digest'
text = "caecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id e
module Steppable
def self.included(base)
base.extend(ClassMethods)
end
def instance_grant_method
puts "Say my name!"
puts "Walter White?"
end
@mohnish
mohnish / benchmark_string_concat_append_+.rb
Created March 29, 2016 20:15
benchmark string concat vs append vs +
require 'benchmark/ips'
n = 100_000
Benchmark.ips do |x|
x.config(time: 5, warmup: 2)
x.report('concat') do |times|
foo = ""
@mohnish
mohnish / clipboard.rb
Created March 15, 2016 19:06
clipboard interface for ruby
# (c) https://github.com/janlelis/clipboard/blob/master/lib/clipboard/mac.rb
require 'open3'
module Clipboard
extend self
def paste(_ = nil)
`pbpaste`
end
@mohnish
mohnish / .irbrc
Created February 29, 2016 21:23
awesome .irbrc
require 'rubygems'
require 'irb/completion'
begin
require 'awesome_print'
AwesomePrint.irb!
rescue LoadError => err
warn "Couldn't load awesome_print: #{err}"
end