Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Snyder nicksnyder

View GitHub Profile
@nicksnyder
nicksnyder / main.go
Created Oct 11, 2018
Hello World in Go
View main.go
package main
import "fmt"
func main() {
printHelloWorld()
}
// printHello prints "hello world" to stdout.
func printHelloWorld() {
View diff.test.ts
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
View HelloWorldAutoLayout.swift
/// 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)
View HelloWorldLayoutKit.swift
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,
View color.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
View NDCollectionViewFlowLayout.h
// 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