Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"io"
"strings"
"sync"
)
const lorem = `Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
function anAction () {
return function (dispatch) {
dispatch(requestStarted())
return fetch().then(
function (success) {
dispatch(requestWasSuccessful(success));
},
function (error) {
dispatch(requestFailed(success));
@kgrz
kgrz / regex-priority.js
Created June 22, 2017 20:21
This is very rough draft of a reverse matcher that returns the most specific matching Regular expression from a list for a given string.
// This is very rough draft of a reverse matcher that returns the most specific
// matching Regular expression from a list for a given string.
//
// Given the following strings that get converted to regular expression
// objects, the `match` function will hopefully return a single regular
// expression which matches the given string `input` most specifically.
const rules = [
'release',
'release-\\d+',
'release-.*',
@kgrz
kgrz / on-jsx.markdown
Created January 24, 2017 12:50 — forked from chantastic/on-jsx.markdown
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 lead 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'

@kgrz
kgrz / Castle.xml
Created December 31, 2016 06:55 — forked from bemasher/Castle.xml
Example of parsing xml in golang.
<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Series>
<id>83462</id>
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors>
<Airs_DayOfWeek>Monday</Airs_DayOfWeek>
<Airs_Time>10:00 PM</Airs_Time>
<ContentRating>TV-PG</ContentRating>
<FirstAired>2009-03-09</FirstAired>
<Genre>|Drama|</Genre>
@kgrz
kgrz / wifi-home
Last active November 7, 2016 09:45
Command line switching of dns servers. Opening "network" settings everytime is _hard_
#!/usr/bin/env ruby
`networksetup -setdnsservers 8.8.8.8 8.8.4.4 Wi-Fi`
`networksetup -getdnsservers Wi-Fi`
@kgrz
kgrz / links.txt
Last active March 22, 2018 06:02
All the links extracted out from https://news.ycombinator.com/item?id=12637239 as of 5th Oct 2016, 6:20PM
@kgrz
kgrz / deploy.yml
Created October 1, 2016 05:34 — forked from rafi/deploy.yml
Ansible prepare a detached git repository and deploy
# -----------------------------------------------
# ENSURE GIT REPOSITORIES
- name: Git | Ensure server repository
sudo_user: git
git: repo={{ upstream }}
dest={{ repo_dir }}
bare=yes
update=no
tags: git
@kgrz
kgrz / GitHub protocol comparison.md
Created October 1, 2016 05:34
A comparison of protocols offered by GitHub (for #git on Freenode).

Primary differences between SSH and HTTPS. This post is specifically about accessing Git repositories on GitHub.

Protocols to choose from when cloning:

plain Git, aka git://github.com/

  • Does not add security beyond what Git itself provides. The server is not verified.

    If you clone a repository over git://, you should check if the latest commit's hash is correct.

@kgrz
kgrz / README.md
Created September 26, 2016 20:33 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version