Skip to content

Instantly share code, notes, and snippets.

View nicksnyder's full-sized avatar

Nick Snyder nicksnyder

View GitHub Profile
@nicksnyder
nicksnyder / main.go
Created October 11, 2018 00:52
Hello World in Go
package main
import "fmt"
func main() {
printHelloWorld()
}
// printHello prints "hello world" to stdout.
func printHelloWorld() {
suite('diff', () => {
suite('transformRange', () => {
test('add one line at beginning', () => {
const diff = new Diff(`diff --git a/comments.txt b/comments.txt
index 63ef680..47010db 100644
--- a/comments.txt
+++ b/comments.txt
@@ -1,3 +1,4 @@
+added line
this is line 1
/// A simple hello world view that uses Auto Layout.
public class HelloWorldAutoLayout: UIView {
private lazy var imageView: UIImageView = {
let imageView = UIImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.setContentHuggingPriority(UILayoutPriorityRequired, forAxis: .Vertical)
imageView.setContentHuggingPriority(UILayoutPriorityRequired, forAxis: .Horizontal)
imageView.setContentCompressionResistancePriority(UILayoutPriorityRequired, forAxis: .Vertical)
imageView.setContentCompressionResistancePriority(UILayoutPriorityRequired, forAxis: .Horizontal)
import LayoutKit
/// A simple hello world layout using LayoutKit.
public class HelloWorldLayout: InsetLayout {
public init() {
super.init(
insets: UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 8),
sublayout: StackLayout(
axis: .horizontal,
@nicksnyder
nicksnyder / color.go
Last active August 29, 2015 14:00
Enum in Go
// This should be in a color/ directory (but gists don't allow subdirectories)
package color
var (
Red = Color{"red"}
Blue = Color{"blue"}
)
type Color struct {
name string
// Created by Nick Snyder on 11/13/12.
// https://gist.github.com/nicksnyder/4075682
// http://stackoverflow.com/questions/12927027/uicollectionview-flowlayout-not-wrapping-cells-correctly-ios
// NDCollectionViewFlowLayout.h
@interface NDCollectionViewFlowLayout : UICollectionViewFlowLayout
@end