Skip to content

Instantly share code, notes, and snippets.

@anhkind
anhkind / enable-camera2api.sh
Created August 22, 2018 08:10
Enable Camera2API
fastboot boot ~/Downloads/twrp-3.2.3-0-nitrogen.img
adb shell
setprop persist.camera.HAL3.enabled 1
setprop persist.camera.eis.enable 1
exit
@anhkind
anhkind / get-set.ts
Last active July 25, 2018 12:20
Typescript - get/set property
class User {
private _birthDate: string;
// can behave like a LAZY property
get birthDate(): string {
if (this._birthDate) {
return this._birthDate;
}
return this._birthDate = '1981-11-11';
DESCRIPTION TEXT COLOR
classic site classic green
PWA PWA red
API API blue
mobile mobile orange
unknown unknown gray
technical debt debt purple
chore chore purple
bug bug black
@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')