Skip to content

Instantly share code, notes, and snippets.

@mmhan
mmhan / how-i-work-template.md
Created July 22, 2022 02:21 — forked from jazzsequence/how-i-work-template.md
Template for How I Like to Work posts

How I work

This is my own interpretation of how I like to work, feedback welcome! Especially if my own view of how I think I like to work doesn't match your experience of how it seems I like to work!

When I work

@mmhan
mmhan / reform_simple_form.rb
Created August 21, 2020 06:22
Reform and Form Helper workaround
# 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 April 5, 2017 13:24
Ruby's hash `merge!` vs `[]`
require "benchmark"
n = 100_000
Benchmark.bm(7) do |x|
x.report("merge! : ") do
a = {}
n.times { |i| a.merge! i => "1" }
end
// 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;
class Person
@@klass_name = "Person"
def initialize(name)
@name = name
end
def self.klass_name
@@klass_name
end

General

  • WPM > 40
    • typing.io
  • Typo-less, par grammar
  • Soft Tab, 2 spaces.
    • Sublime -
    • Vim -
    • Android Studio 0-
  • XCode -
@mmhan
mmhan / original
Last active January 4, 2016 08:29
The Tortoise and the Hare
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 December 26, 2013 09:34
MM Phone Number Regex
/^((\+\d+)*(\d+)[- ])*\d{3,}[- ]*\d{3,}$/
root (hd0, 5)
kernel /vmlinuz root=/dev/sda6
initrd /initrd.img
boot
@mmhan
mmhan / api.php
Last active December 25, 2015 01:09
Parameters and terms
<?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)