Skip to content

Instantly share code, notes, and snippets.

@twnaing
twnaing / iDeviceSafariDelicious
Created March 23, 2012 05:50
Bookmarklet code to add delicious bookmark in iPad
javascript:(
function(){
f=’http://delicious.com/save?url=’+encodeURIComponent(window.location.href)+’&title=’+encodeURIComponent(document.title)+’&v=5&’;
a=function()
{
if(!window.open(f+’jump=doclose’,'deliciousuiv5′,’location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550′))
location.href=f+’jump=yes’
};
if(/Firefox/.test(navigator.userAgent))
{

Keybase proof

I hereby claim:

  • I am twnaing on github.
  • I am twnaing (https://keybase.io/twnaing) on keybase.
  • I have a public key whose fingerprint is DF32 4908 60CF D813 AD2F 6E76 E0E2 49A9 A39F D5C2

To claim this, I am signing this object:

@twnaing
twnaing / bump-version.sh
Created March 16, 2017 03:41 — forked from mareksuscak/bump-version.sh
Bump version shell script.
#!/bin/bash
# Thanks goes to @pete-otaqui for the initial gist:
# https://gist.github.com/pete-otaqui/4188238
#
# Original version modified by Marek Suscak
#
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3" or even "1.2.3-beta+001.ab"
@twnaing
twnaing / cloudSettings
Last active August 31, 2021 09:12
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-08-31T09:12:11.160Z","extensionVersion":"v3.4.3"}
Name Language Config format Stars Contributors Last update page
tmuxinator ruby yaml 9132 108 5/23/2019 https://github.com/tmuxinator/tmuxinator
teamocil ruby yaml 1926 6 9/1/2019 https://github.com/remiprev/teamocil
tmuxp python yaml, json 2466 39 6/7/2019 https://github.com/tmux-python/tmuxp
tmuxomatic python yaml 999 6 4/26/2016 https://github.com/oxidane/tmuxomatic
@twnaing
twnaing / Caddyfile
Created July 3, 2020 08:37
Caddyfile v2 for Ruby on Rails application
http://{$CADDY_HOST}:{$CADDY_PORT} {
root * ./public
@notStatic {
not {
file {
try_files {path}
}
}
}
@twnaing
twnaing / house_buyers_controller.rb
Created December 15, 2021 05:11
Rails: Get the model class name based on the controller class name
class HouseBuyersController < ApplicationController
def index
@model_name = controller_name.classify
# Equivalent of @house_buyers = HouseBuyer.find(:all)
objects = @model_name.constantize.find(:all)
instance_variable_set("@#{controller_name}", objects)
end
end