Skip to content

Instantly share code, notes, and snippets.

View Pyrolistical's full-sized avatar

Pyrolistical

View GitHub Profile
@Pyrolistical
Pyrolistical / index.html
Last active October 26, 2017 23:23
hyperapp module state bug
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hyperapp Views</title>
</head>
<body>
<div id="app-entry"></div>
<script src="https://unpkg.com/[email protected]/dist/hyperapp.js"></script>
@Pyrolistical
Pyrolistical / index.html
Last active October 27, 2017 06:18
Hyperapp views PoC
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hyperapp Views</title>
</head>
<body>
<div id="app-entry"></div>
<script src="https://unpkg.com/[email protected]/dist/hyperapp.js"></script>
@Pyrolistical
Pyrolistical / child.html
Created August 8, 2017 23:29
Repo case for firebase iframe sandbox issue
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>I r child</title>
<style>
body {
margin: 0;
padding: 0;
@Pyrolistical
Pyrolistical / anotherfile.d.ts
Created May 8, 2017 21:46
typescript checkJs + node
export interface AnotherfileStatic {
validfunction(greeting: string);
}
declare const Anotherfile: AnotherfileStatic;
export default Anotherfile;
@Pyrolistical
Pyrolistical / server.js
Created November 29, 2016 09:13
Factory Function Injection
const MongoClient = require('mongodb').MongoClient
const Controller = require('./controller')
const Service = require('./service')
const Repository = require('./repository')
MongoClient.connect('some mongo url')
.then((db) => {
const repository = Repository(db)
const service = Service(repository)
@Pyrolistical
Pyrolistical / flow.txt
Created May 16, 2016 08:18
abandoning prerender
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Battlefy</title>
</head>
<body>
<div id="react-entry">
</div>
<script type="text/javascript" src="bundle.js" charset="utf-8"></script>
@Pyrolistical
Pyrolistical / less-nested.js
Created April 29, 2016 18:05
example how to reduce nesting
const getUserByEmail = (connection, userEmail) => {
const userPromise = connection
.queryAsync(‘SELECT `id` FROM `user` WHERE `email` = ?’, [
userEmail
])
.then(R.head);
const permissionsPromise = userPromise
.then(R.unless(R.isNil, (user) => connection
.queryAsync(‘SELECT `id`, `name` FROM `permission` WHERE `user_id` = ?’, [
@Pyrolistical
Pyrolistical / .profile
Created December 24, 2014 01:19
best .profile
RIGINAL_PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
source `brew --prefix git`/etc/bash_completion.d/git-prompt.sh
source `brew --prefix git`/etc/bash_completion.d/git-completion.bash
export JAVA_HOME=`/usr/libexec/java_home`
export MAVEN_HOME='/usr/local/opt/maven/libexec/'
export PATH="$ORIGINAL_PATH:/Users/rchen/dev/tools/bin"
@Pyrolistical
Pyrolistical / ts
Created November 28, 2014 00:59
timestamp each line from stdin
#!/bin/bash
DATECMD='gdate +%s%N'
process_stdout() {
while read line; do
echo -e `$DATECMD`"\t$line"
done
}
@Pyrolistical
Pyrolistical / hlight
Created November 28, 2014 00:57
highlights text from stdin
#!/bin/bash
grep --color "$1\|\$" -