Note: everything here is pretty specific to my usage/accounts and not written for public use... You'll probably have to tweak a bunch of stuff.
$ bean-extract config.py ~/Downloads # the csvs should be in here| javascript:function minutesSeconds(s){return(s-(s%=60))/60+(9<s?':':':0')+s}function start(){var currentURL=window.location.href;var bar=document.getElementsByClassName("ytp-progress-bar")[0];var seconds=bar.getAttribute("aria-valuenow");var secondsInMS=minutesSeconds(seconds);var URL=currentURL+"?t="+seconds;var obsidianFormat="["+secondsInMS+"]("+URL+")";navigator.clipboard.writeText(obsidianFormat);null;var elemDiv=document.createElement('div');elemDiv.innerHTML="<h1 style='font-size:100px; color:white; text-align:center; margin-top:2em;'>"+secondsInMS+"</h1>";elemDiv.style.cssText='position:absolute;width:100%;height:100%;opacity:0.8;z-index:1000;background:#000;';document.body.appendChild(elemDiv);setTimeout(function(){elemDiv.style.display="none"},600)}start(); |
| // Stream | |
| const stream = f => (x => x(x))(y => init => [init, m => y(y)(f(m))]); | |
| const add3Stream = stream(n => n + 3); | |
| const mult2Stream = stream(n => n * 2); | |
| const inspect = stream(n => { | |
| console.log('inspect:' + n); | |
| return 0; | |
| }); | |
| const pipe = s1 => s2 => x => { |
| // basic idea | |
| (f => f(f)(5))(f => n => n == 0 ? 1 : (n * f(f)(n-1))); | |
| // This version doesn't work, because js is not lazy. | |
| // const Y = f => (x => f(x(x)))(x => f(x(x))); | |
| // const Y = f => (x => x(x))(x => f(a => x(x)(a))); | |
| const Y = f => (x => f(y => x(x)(y)))(x => f(y => x(x)(y))); |
| // At first, we need to build empty map. | |
| // Empty map is just a function, it will return undefined when invoked. | |
| // When you set new key-value into map, it will wrap a new function around previous map, | |
| // and when you get something from map with key, it will pass key to every nested function until it match or hit empty map. | |
| const map = () => undefined; | |
| const set = map => (key, value) => q => q === key ? value: map; | |
| const get = map => key => typeof map === 'function' ? get(map(key))(key) : map; | |
| // Demo time! |
| // First we need to build data structure pair(a, b) | |
| // cons: given a and b, and return a function. | |
| // when you pass cons(a, b) as argument to car, it will return a; | |
| // if you pass it to cdr, it will return b. | |
| const cons = (a, b) => p => p ? a : b; | |
| const car = pair => typeof pair === 'function' ? pair(1) : null; | |
| const cdr = pair => typeof pair === 'function' ? pair(0) : null; | |
| // Now we can build list by chaining pair. | |
| // For example, list [1, 2, 3] will be represented as cons(1, cons(2, 3)) |
Note: everything here is pretty specific to my usage/accounts and not written for public use... You'll probably have to tweak a bunch of stuff.
$ bean-extract config.py ~/Downloads # the csvs should be in here| # Install brew | |
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| # Install composer | |
| brew install homebrew/php/composer | |
| ### PHPCS | |
| composer global require "squizlabs/php_codesniffer=*" | |
| # Add to your .bash_profile |
| Disclaimer: The instructions are the collective efforts from a few places online. | |
| Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did. | |
| First off, bundle. | |
| ================== | |
| 1. cd to the project directory | |
| 2. Start the react-native packager if not started | |
| 3. Download the bundle to the asset folder: | |
| curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" |
| package main | |
| // http://play.golang.org/p/jZ5pa944O1 <- will not display the colors | |
| import "fmt" | |
| const ( | |
| InfoColor = "\033[1;34m%s\033[0m" | |
| NoticeColor = "\033[1;36m%s\033[0m" | |
| WarningColor = "\033[1;33m%s\033[0m" | |
| ErrorColor = "\033[1;31m%s\033[0m" | |
| DebugColor = "\033[0;36m%s\033[0m" |