This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e # exit on error | |
set -u # error on undefined variable | |
set -o posix # errors in $() expressions propagate outwards | |
set -o pipefail # errors in a pipeline will propagate outwards | |
# set -e | |
# Any command returning a nonzero code will exit the script | |
# If you need to run a command that may file, use it either in `if` expressions, or part of an `or` expression such as `command || true` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This reverse proxy is for local development only | |
const express = require("express"); | |
const proxy = require("express-http-proxy"); | |
const app = express(); | |
const proxyPort = 8000; | |
const webpackPort = 8080; | |
app.use("/", proxy(`http://localhost:${webpackPort}`)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Loader from './loader'; | |
const drawChart = (data, div) => { | |
// omitted | |
// Can use the loaded script safely | |
} | |
export default ({data}) => ( | |
<Loader> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build app | |
FROM golang as builder | |
COPY . /build | |
RUN cd /build && CGO_ENABLED=0 go build -ldflags='-s -w' app.go | |
# Compress | |
FROM lalyos/upx as compressor | |
COPY --from=builder /build/app /compress/ | |
RUN ["upx", "/compress/app"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Balls.</title> | |
<meta name="viewport" content="width=device-width" /> | |
<style> | |
html, body { | |
width: 100vw; | |
height: 100vh; | |
margin: 0; | |
display: flex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@PENSIVE ~ $ du -sh *-web/.git/objects | |
42M 2-paystream-web/.git/objects | |
57M 3-paystream-web/.git/objects | |
73M 4-paystream-web/.git/objects | |
8.1M paystream-web/.git/objects | |
user@PENSIVE ~ $ for i in *web; do pushd $i; git gc; popd; done | |
~/2-paystream-web ~ | |
Counting objects: 171965, done. | |
Delta compression using up to 8 threads. | |
Compressing objects: 100% (33235/33235), done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// See http://en.wikipedia.org/wiki/Floyd-Steinberg_dithering for algorithm details. | |
/// The matrix used is Sierra [/32]: | |
/// x 5 3 | |
/// 2 4 5 4 2 | |
/// 2 3 2 | |
/// </summary> | |
protected static Bitmap ErrorDiffusion(System.Drawing.Image bitmap) { | |
const double limit = 0.5; | |
var errors = new ErrorArray(bitmap.Width, bitmap.Height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text; | |
namespace Misadonet.Server.Test { | |
class UltimateTestCase { | |
public void Run() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Applicative | |
options = [(3, "Fizz"), (5, "Buzz")] | |
collect :: [(Integer, String)] -> Integer -> String | |
collect [] x = "" | |
collect ((divisor,string):rest) x | |
| x `mod` divisor == 0 = string ++ collect rest x | |
| otherwise = collect rest x |