Skip to content

Instantly share code, notes, and snippets.

@anhkind
anhkind / upgrade-angular.sh
Last active April 18, 2018 10:26
Upgrade Angular
# from https://github.com/angular/angular-cli/issues/4391#issuecomment-277199786
# Fix global angular/cli
npm uninstall -g angular-cli
npm cache clean --force
npm install -g @angular/cli@latest
# Fix local angular/cli and angular
rm -rf node_modules dist
npm uninstall --save-dev angular-cli
@anhkind
anhkind / custom_outlet_nested_routes.ts
Last active July 10, 2017 12:33
nested routes of a custom outlet which use parent's template
// route definition
route = {
path: '',
component: CustomLayoutComponent,
outlet: 'custom',
children: [{
path: 'child-route',
component: ChildComponent
}]
}
@anhkind
anhkind / angular_vs_react.md
Last active May 1, 2017 06:06
Angular vs React resources
@anhkind
anhkind / full_replicated_shards.yml
Last active April 27, 2017 07:37 — forked from eprothro/shards.yml
This has some minor changes from the original as `fully_replicated` is set to `true` and the key `followers` under `optopus/environments` is removed
<%
require 'cgi'
require 'uri'
def attribute(name, value, force_string = false)
if value
value_string =
if force_string
'"' + value + '"'
else
@anhkind
anhkind / reflect.py
Created November 21, 2016 15:51 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@anhkind
anhkind / iterm2_keymap.txt
Created September 11, 2016 09:30
iTerm2 keymap for cursor
FOR ACTION SEND
⌘← "HEX CODE" 0x01
⌘→ "HEX CODE" 0x05
⌥← "SEND ESC SEQ" b
⌥→ "SEND ESC SEQ" f
@anhkind
anhkind / file.js
Last active July 14, 2016 14:47
Get AngularJS service in browser console
$http = angular.element(document.body).injector().get('$http')
@anhkind
anhkind / gdb_ruby_backtrace.py
Created June 15, 2016 15:40 — forked from csfrancis/gdb_ruby_backtrace.py
Dump an MRI call stack from gdb
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
def get_lineno(iseq, pos):
@anhkind
anhkind / open_ios_simulator.sh
Created May 11, 2016 08:52
Open iOS simulator
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
@anhkind
anhkind / curl_with_json.sh
Created April 14, 2016 19:14
Curl commands with json data
# GET
curl -v -H "Content-type: application/json" -H "Accept: application/json" -H "X-AUTH-TOKEN:123456" -X GET -d '{"q":"core"}' http://localhost:3000/search