Skip to content

Instantly share code, notes, and snippets.

View peteygao's full-sized avatar
💭
Writing Elm @ LearningLoop.com

Peter Gao peteygao

💭
Writing Elm @ LearningLoop.com
  • CTO @ LearningLoop.com
  • Singapore / San Francisco
View GitHub Profile
@Janiczek
Janiczek / Genetic.elm
Created October 4, 2021 19:00
Genetic Algorithm in Elm
module Genetic exposing (Config, Goal(..), run)
import List.Extra as List
import Random exposing (Generator)
import Random.Extra as Random
import Random.List
type alias Config solution =
{ newSolution : Generator solution
@romainl
romainl / colorscheme-override.md
Last active April 27, 2024 15:36
The right way to override any highlighting if you don't want to edit the colorscheme file directly

The right way to override any highlighting if you don't want to edit the colorscheme file directly

Generalities first

Suppose you have weird taste and you absolutely want:

  • your visual selection to always have a green background and black foreground,
  • your active statusline to always have a white background and red foreground,
  • your very own deep blue background.
@arya-oss
arya-oss / INSTALL.md
Last active November 18, 2023 13:58
Ubuntu 16.04 Developer Tools installation

Ubuntu 16.04 Developer Tools Installation

First things first !

sudo apt update
sudo apt upgrade

Standard Developer Tools

sudo apt-get install build-essential git
@troex
troex / my_controller.rb
Last active October 7, 2021 09:41
Sinatra + EventMachine + Puma – Heroku workaround for 30 seconds timeout
module Application
module Controllers
class MyController < Sinatra::Base
helpers Sinatra::Streaming
class << self
def stream(method, path, opts = {}, &block)
send(method, path, opts) do
stream do |out|
timer = EventMachine::PeriodicTimer.new(10) { out << "\0" }
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@omnibs
omnibs / phoenix showdown rackspace onmetal io.md
Last active January 25, 2023 18:33
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@VladSem
VladSem / tmux2_raspberry.sh
Created May 23, 2015 05:43
install tmux 2.0 on Raspberry Pi (Debian 7.8) Raspbian Wheezy
#!/bin/bash
wget "https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
tar -xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make verify
sudo make install
sudo ldconfig
@pigoz
pigoz / config_development.rb
Last active July 26, 2020 16:24
puma cluster mode + sidekiq
threads 1, 4
workers 2
preload_app!
environment 'development'
bind 'tcp://0.0.0.0:3000'
ssl_bind '127.0.0.1', '5002', {
key: 'doc/certs/server.key',
cert: 'doc/certs/server.crt'
}
@Integralist
Integralist / Ruby Lambdas.md
Last active August 8, 2023 05:10
Ruby lambdas

Lambda: standard

# Creating a lambda
l = lambda { |name| "Hi #{name}!" }

# Executing the lambda
l.call("foo") # => Hi foo!
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key