Skip to content

Instantly share code, notes, and snippets.

Dor Kleiman configurator

Block or report user

Report or block configurator

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
configurator / component.jsx
Created Nov 3, 2019
Using components that require a loaded script using react-load-script
View component.jsx
import React from 'react';
import Loader from './loader';
const drawChart = (data, div) => {
// omitted
// Can use the loaded script safely
export default ({data}) => (
configurator / Dockerfile
Created Mar 29, 2018
UPX in Docker breaks Go app
View Dockerfile
# 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"]
View balls..html
<meta name="viewport" content="width=device-width" />
html, body {
width: 100vw;
height: 100vh;
margin: 0;
display: flex;
configurator / gist:5ca2b928c9c82827c6a734f690b28c04
Created Jun 1, 2017
When git gc does exactly the opposite of what you expect
View gist:5ca2b928c9c82827c6a734f690b28c04
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.
configurator / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
configurator / gist:cd0cb436e43001b9cab4
Created Oct 15, 2014
ErrorDiffusion dithering using the Sierra Matrix
View gist:cd0cb436e43001b9cab4
/// <summary>
/// See 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);
configurator / UltimateTestCase.cs
Created Oct 10, 2014
100% test coverage is easy. Making it useful is practically impossible.
View UltimateTestCase.cs
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() {
configurator / fizzbuzz.hs
Created Dec 14, 2013
FizzBuzz in Haskell
View fizzbuzz.hs
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
You can’t perform that action at this time.