Skip to content

Instantly share code, notes, and snippets.

@isao
isao / runloop-decorators.js
Created January 26, 2021 19:54
`this.args` is undefined in methods wrapped with these decorators.
import { debounce as _debounce, throttle as _throttle } from '@ember/runloop';
function timingDecorator(fn) {
return function (delay) {
return function (instance, property, descriptor) {
return {
value(...args) {
if (!instance.isDestroying && !instance.isDestroyed) {
return fn(instance, descriptor.value, ...args, delay);
}
@isao
isao / use-bbdiff
Created January 21, 2021 19:07 — forked from wholmgren/use-bbdiff
set git difftool to bbdiff
git config --global diff.tool bbdiff
git config --global difftool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"'
git config --global difftool.prompt false
git config --global merge.tool bbdiff
git config --global mergetool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"'
Double check ~/.gitconfig
@isao
isao / types.ts
Created January 14, 2021 01:15 — forked from ClickerMonkey/types.ts
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
@isao
isao / line-clamp.scss
Last active March 4, 2021 21:56
dma/app/styles/core/mixins/line-clamp.scss
///
/// Line-Clamp
///
/// https://medium.com/@elad/trimming-multi-lines-in-css-5ae59d5e6d84
///
@mixin line-clamp($lines: null) {
@if $lines != null {
display: -webkit-box; /* stylelint-disable-line value-no-vendor-prefix */
-webkit-line-clamp: $lines;
@isao
isao / plink-plonk.js
Created March 30, 2020 16:03 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@isao
isao / com.startup.plist
Created March 24, 2020 17:36 — forked from codeZoner/com.startup.plist
Launch Demon Start up with Bash Script with MySQL Example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Launch Daemon do not always have access to all the path variables
As a results, scripts will sometimes fail if the you are using path variables inside them
To enable the script to have access to all path variables, open up a terminal and type in -->
<!-- echo $PATH -->
<!-- You can opt to filter out some of the path variables which are not required by script-->
<key>EnvironmentVariables</key>
@isao
isao / TypeScript.ctags
Created October 30, 2018 23:50
~/.ctags/TypeScript.ctags to index Typescript code
--langdef=TypeScript
--langmap=typescript:.ts
--langmap=typescript:+.tsx
--regex-typescript=/^[ \t]*(export([ \t]+)?)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\3/c,classes/
--regex-typescript=/^[ \t]*(declare)?[ \t]*namespace[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+(var|let|const)[ \t]+([a-zA-Z0-9_]+)/\2/v,variables/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|protected|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/
--regex-typescript=/^[ \t]+([a-zA-Z$_][a-zA-Z0-9$_]*)(<[^>]+>)?\([^\)]*\): .+ \{/\1/m,members/
@isao
isao / ADB Commands
Created June 8, 2018 17:24 — forked from TheMightyLlama/ADB Commands
List of ADB commands for obtaining information from an application
#Gets screen capture of device every 270 seconds and outputs screencap to timestamped png file in local directory
while true; do adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ScreenCap.`date +%Y`.`date +%m`.`date +%d`-`date +%H`.`date +%M`.`date +%S`.png; sleep 270; done
#Gets logs from device and outputs them to a timestamped file in local directory
while true; do adb logcat -v time > logging`date +%Y`.`date +%m`.`date +%d`-`date +%H`.`date +%M`.`date +%S`.txt; done
#Gets PID of <packagename>
adb shell ps | grep <packagename>
#Outputs battery level to console
@isao
isao / push-apk.sh
Created June 5, 2018 23:14
push-apk.sh
#!/bin/bash -eu
#
# Config.
#
# Arg 1: file to install on the Android OTT STB, which must be connected, and
# mounted read/write as root. See connect-remount-as-root.sh
apkpath=${1:-''}
@isao
isao / functions.sh
Created May 24, 2018 21:23 — forked from junegunn/functions.sh
Key bindings for git with fzf (https://junegunn.kr/2016/07/fzf-git/)
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% "$@" --border
}