Skip to content

Instantly share code, notes, and snippets.

View iamralch's full-sized avatar

Svetlin Ralchev iamralch

View GitHub Profile
@iamralch
iamralch / gist:c4e883f12be80d815d7f
Last active September 5, 2015 13:16 — forked from richp10/gist:1c367d3c67aec762788e
Secure iptables configuration for coreos ??
// This systemd runs iptables-restore on boot:
[Unit]
Description=Packet Filtering Framework
DefaultDependencies=no
After=systemd-sysctl.service
Before=sysinit.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/iptables-restore /opt/docker/scripts/iptables/iptables.rules
package main
//go:generate jsonenums -type=Status
type Status int
const (
Pending Status = iota
Sent
Received
Rejected
//go:generate ffjson $GOFILE
package education
type Student struct {
FirstName string
LastName string
}
type University struct {
Name string
package main
import "fmt"
//go:generate stringer -type=MessageStatus
type MessageStatus int
const (
Sent MessageStatus = iota
Received
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Modified into a gotemplate by Nick Craig-Wood <nick@craig-wood.com>
// Package list implements a doubly linked list.
//
// To iterate over a list (where l is a *List):
// for e := l.Front(); e != nil; e = e.Next() {
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
@iamralch
iamralch / spec.pb.go
Created December 17, 2015 08:25
Sample Golang implementation of spec.proto
// Code generated by protoc-gen-go.
// source: spec.proto
// DO NOT EDIT!
/*
Package example is a generated protocol buffer package.
It is generated from these files:
spec.proto
@iamralch
iamralch / spec.proto
Created December 17, 2015 08:26
Protocol Buffers Company Example
syntax = 'proto2';
package example;
enum CompanyType {
Private = 17;
Public = 18;
NonProfit = 19;
};
@iamralch
iamralch / zipit_keep_hierarchy.go
Created November 20, 2015 09:20
Modification of ZipIt function to keep the directory hierarchy or not
func zipit(source, target string, keepHierarchy bool) error {
zipfile, err := os.Create(target)
if err != nil {
return err
}
defer zipfile.Close()
archive := zip.NewWriter(zipfile)
defer archive.Close()
@iamralch
iamralch / on-jsx.markdown
Created February 16, 2017 14:17 — 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'