Skip to content

Instantly share code, notes, and snippets.

View jeanbza's full-sized avatar
🐘

Jean Barkhuysen jeanbza

🐘
View GitHub Profile
@myitcv
myitcv / report.md
Last active November 7, 2018 23:25
Experience report for creating a submodule within an existing module

Background

GopherJS is a compiler from Go to JavaScript that targets browser VMs.

The package github.com/gopherjs/gopherjs is the compiler program, responsible for transpiling Go code to JavaScript.

The package github.com/gopherjs/gopherjs/js provides an API for interacting with native JavaScript.

Because of the limited runtime environment afforded by a JavaScript VM (especially in the browser), GopherJS provides

@trianta2
trianta2 / a6_utils.py
Created November 20, 2017 17:34
A6 part 2 utilities
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Provides A6 part 2 utils
"""
import random
_CHARS_SPACE = ['A', 'Y', 'Z', ' ']
_CHARS = ['A', 'Y', 'Z']
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Change the background color!</h1>
<input placeholder="Enter a color">
<button>Change background</button>
<p>Refer to <a href="https://en.wikipedia.org/wiki/Web_colors#HTML_color_names" target="_blank">this list</a> of HTML color names for color ideas, or try entering hex color codes!</p>
Example of rkt today with systemd service file generation and systend-nspawn execution of systemd.
$ sudo rkt run docker://redis --insecure-options image
$ rkt list | grep redis
764de9a0 redis registry-1.docker.io/library/redis:latest running 5 minutes ago 5 minutes ago default:ip4=172.16.28.2
$ ps aux | grep 764de9a0
root 8168 4.4 0.1 41780 4440 pts/2 S+ 19:04 0:13 stage1/rootfs/usr/lib/ld-linux-x86-64.so.2 stage1/rootfs/usr/bin/systemd-nspawn --boot --register=true --link-journal=try-guest --quiet --uuid=764de9a0-9442-4512-9d73-5a040dac5fe2 --machine=rkt-764de9a0-9442-4512-9d73-5a040dac5fe2 --directory=stage1/rootfs --bind=/mnt/sda1/var/lib/rkt/pods/run/764de9a0-9442-4512-9d73-5a040dac5fe2/sharedVolumes/redis-volume-data:/opt/stage2/redis/rootfs/data --capability=CAP_AUDIT_WRITE,CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FSETID,CAP_FOWNER,CAP_KILL,CAP_MKNOD,CAP_NET_RAW,CAP_NET_BIND_SERVICE,CAP_SETUID,CAP_SETGID,CAP_SETPCAP,CAP_SETFCAP,CAP_SYS_CHROOT -- --default-standard-output=tty --log-target=nul
@elainemckinley
elainemckinley / vi_multiple.md
Created May 11, 2015 16:09
Search and replace in multiple files with Vim
  1. Enter vi edit mode for multiple files:
$ ○ → vi webapps/*.xml
5 files to edit
  1. See all files you're editing: :ls
  2. Search and replace across all files: :argdo %s/old-foo/new-foo/ge
@chantastic
chantastic / on-jsx.markdown
Last active May 30, 2024 13:11
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@subfuzion
subfuzion / global-gitignore.md
Last active July 16, 2024 18:54
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@jeanbza
jeanbza / automate_2048.md
Last active July 9, 2023 03:42
Automate 2048

So I got to playing 2048 a decent amount, and starting getting the feeling that there was a 'pattern' that would win this game for me. Perhaps you've had the same thought! As a result, I wrote a little snippet of code that that cycles throw the keys Up, Right, Down, Left (feel free to create your own pattern).

Copy and paste this into your Chrome/Firefox console to automate 2048!

Firefox

function pressKey(i) {
  var evt = document.createEvent("KeyboardEvent");
  evt.initKeyEvent ("keydown", true, true, window, 0, 0, 0, 0, 37+i%4, 37+i%4);
 document.dispatchEvent(evt);
@jmoiron
jmoiron / valuer.go
Created October 14, 2013 18:03
Example uses of sql.Scanner and driver.Valuer
package main
import (
"bytes"
"compress/gzip"
"database/sql/driver"
"errors"
"fmt"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
@andrewjkerr
andrewjkerr / json-parser-example.json
Last active December 16, 2015 03:19
This is a parsing example for the udp/json-parser which can be found here: (https://github.com/udp/json-parser.) This parser allows for easy parsing of a JSON file in C++. --- The sample JSON file is an example using the old Facebook Graph API
{
"data": [
{
"birthday": "01/01/2000",
"first_name": "John",
"last_name": "Doe",
"hometown": {
"name": "Tampa, Florida"
},
},