Skip to content

Instantly share code, notes, and snippets.

Nami WANG namiwang

Block or report user

Report or block namiwang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
namiwang / patch_simulating_middleware.rb
Last active Aug 27, 2019
middleware to simulate PATCH method with a POST when client doesn't support it
View patch_simulating_middleware.rb
class PatchSimulatingMiddleware
def initialize app
@app = app
def call env
request =
if && ( request.params['_name'] == 'patch' )
request.set_header 'REQUEST_METHOD', 'PATCH'
View gist:54334bf7f40f8d8e7dda0b9b5430719e
azure storage cors set -a [-beep-] -k [-beep-] --blob --cors "[{\"AllowedOrigins\":\",\",\"AllowedMethods\":\"GET\",\"MaxAgeInSeconds\":\"86400\",\"AllowedHeaders\":\"*\",\"ExposedHeaders\":\"*\"}]"
namiwang /
Created May 30, 2016
azure blob folder uploader
export AZURE_STORAGE_ACCOUNT='your_account'
export AZURE_STORAGE_ACCESS_KEY='your_access_key'
export container_name='name_of_the_container_to_create'
export source_folder=~/path_to_local_file_to_upload/*
namiwang / ideagen
Created Jun 23, 2013
get random words from matrix67's idea generator
View ideagen
require 'nokogiri'
require 'open-uri'
50.times do
page = Nokogiri::HTML(open(""))
word = page.css('body .main p').children[0].to_s.gsub("\r",'').gsub("\n",'').gsub("\t",'').split('的')[1]'words','a'){ |file| file.write(word+"\n") }
You can’t perform that action at this time.