This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import Combine | |
struct ContentView: View { | |
@EnvironmentObject private var model: ViewModel | |
@StateObject private var searchQuery = SearchQueryDebouncer() | |
var body: some View { | |
List { | |
… |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// file path: myproject/proto/msg1/generate.go | |
package proto | |
//go:generate protoc -I/usr/local/include -I. -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. msg1.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [Two-Man Rule](https://en.wikipedia.org/wiki/Two-man_rule) | |
## Model | |
Create two locks. | |
``` | |
commit @model | |
[#lock name: "Lock 1", locked: true] | |
[#lock name: "Lock 2", locked: true] | |
``` | |
Unlock locks when their key is turned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sanitizeHtml = require('sanitize-html'); | |
function localSanitizeHtml(html) { | |
let allowedAttributes = JSON.parse(JSON.stringify(sanitizeHtml.defaults.allowedAttributes)); | |
allowedAttributes.a = (allowedAttributes.a || []).concat(['data-trix-attachment', 'rel']); | |
allowedAttributes.figure = (allowedAttributes.figure || []).concat(['class']); | |
allowedAttributes.figcaption = (allowedAttributes.figcaption || []).concat(['class']); | |
allowedAttributes.img = (allowedAttributes.img || []).concat(['width', 'height']); | |
allowedAttributes.span = (allowedAttributes.span || []).concat(['class']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/Eiam8821/07a7372667879172e9df | |
enum TakeWhileState { | |
case Continuing(Int) | |
case Done | |
} | |
struct TakeWhileGenerator<T>: GeneratorType { | |
let sequence: TakeWhile<T> | |
var state: TakeWhileState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am alltom on github. | |
* I am alltom (https://keybase.io/alltom) on keybase. | |
* I have a public key whose fingerprint is 83BA 6BBE 850C A897 1A4B FBF8 75F4 6A37 8603 F396 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation VP2CollectionViewLayout | |
#pragma mark - Called during the layout process | |
// step 1 | |
- (void)prepareLayout | |
{ | |
// if it's not too much data, create all element attributes here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# translates "git git status" -> "git status" | |
# install as "git-git" in your path | |
while [[ $1 == "git" ]]; do | |
shift | |
done | |
git $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# context-sensitive "open" alternative | |
# just go into a directory and run "oo" | |
# the correct project editor be used to open it | |
# usage: | |
# $ oo guess what to do with current directory | |
# $ oo [file or directory] guess what to do with the given file/directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "osc" | |
SERVER_HOST = "localhost" | |
SERVER_PORT = 5000 | |
conn = OSC::UDPSocket.new | |
msg = OSC::Message.new("/live/add", "s", $stdin.read) | |
conn.send msg, 0, SERVER_HOST, SERVER_PORT |
NewerOlder