Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Myat Min Han mmhan

View GitHub Profile
@mmhan
mmhan / reform_simple_form.rb
Created Aug 21, 2020
Reform and Form Helper workaround
View reform_simple_form.rb
# concepts/thing/contract/contract.rb
require 'disposable/twin/property/hash'
module Thing::Contract
class Contract < Reform::Form
include Disposable::Twin::Property::Hash
property :data, field: :hash do
property :foo_bar
@mmhan
mmhan / merge_vs_assign.rb
Last active Apr 5, 2017
Ruby's hash `merge!` vs `[]`
View merge_vs_assign.rb
require "benchmark"
n = 100_000
Benchmark.bm(7) do |x|
x.report("merge! : ") do
a = {}
n.times { |i| a.merge! i => "1" }
end
View complexConstructor.java
// simple constructor
//
private final int x;
private final int y;
private final String z;
public MyClass(int x, int y, String z) {
this.x = x;
this.y = y;
this.z = z;
View person.rb
class Person
@@klass_name = "Person"
def initialize(name)
@name = name
end
def self.klass_name
@@klass_name
end
View Manual.md

General

  • WPM > 40
    • typing.io
  • Typo-less, par grammar
  • Soft Tab, 2 spaces.
    • Sublime -
    • Vim -
    • Android Studio 0-
    • XCode -
@mmhan
mmhan / original
Last active Jan 4, 2016
The Tortoise and the Hare
View original
There is a Hare and
a tortoise.
The hare and tortoise race.
The hare thinks that he is fast
and the tortoise is slow.
He decided to take a nap.
But he slept for too long and the tortoise passes him.
And the tortoise won the race.
@mmhan
mmhan / gist:8131701
Created Dec 26, 2013
MM Phone Number Regex
View gist:8131701
/^((\+\d+)*(\d+)[- ])*\d{3,}[- ]*\d{3,}$/
View gist:8028360
root (hd0, 5)
kernel /vmlinuz root=/dev/sda6
initrd /initrd.img
boot
@mmhan
mmhan / api.php
Last active Dec 25, 2015
Parameters and terms
View api.php
<?php
/**
* Will take given parameters, query and return a list of listings for given params
*
* PARAMETERS
* ===================
*
* q Search string. Default = null (optional)
* build Car's build type Default = null (optional)
* make Manufacturer Default = null (optional)
View functions.php
<?php
/**
* MMJDB Google docs form embedding
**/
function mmjdb_some_form(){
if(is_page('page_slug')){
echo '<iframe src="https://docs.google.com/spreadsheet/embeddedform?formkey=dE1GWmZYTDNpSG5CSkVRZWgtc0JyWHc6MQ" width="906" height="790" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>';
}
}
You can’t perform that action at this time.