irb(main):005:0> a = [1, 2, 3]
=> [1, 2, 3]
irb(main):007:0> a.first
=> 1
irb(main):008:0> a
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. |
This file contains hidden or 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
function v() { | |
setopt +o nomatch # suppress zsh message | |
if [ -z $1 ]; then | |
DIR="." | |
else | |
DIR=$1 | |
fi | |
WORKSPACE=`find $DIR -maxdepth 1 -name *.code-workspace 2>/dev/null` | |
if [ $? -eq 0 ] && [ -n "$WORKSPACE" ]; then | |
DIR=$WORKSPACE |
This file contains hidden or 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
struct FNV1A { | |
static let FNVOffsetBasis: UInt = 14695981039346656037 | |
static let FNVPrime: UInt = 1099511628211 | |
static func digest(of source: String) -> UInt { | |
var hash = FNVOffsetBasis | |
for byte in [UInt8](source.utf8) { | |
hash ^= UInt(byte) | |
hash &*= FNVPrime | |
} |
This file contains hidden or 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
$ docker run --rm theyahya/sherlock morishin | |
."""-. | |
/ \ | |
____ _ _ _ | _..--'-. | |
/ ___|| |__ ___ _ __| | ___ ___| |__ >.`__.-""\;"` | |
\___ \| '_ \ / _ \ '__| |/ _ \ / __| |/ / / /( ^\ | |
___) | | | | __/ | | | (_) | (__| < '-`) =|-. | |
|____/|_| |_|\___|_| |_|\___/ \___|_|\_\ /`--.'--' \ .-. | |
.'`-._ `.\ | J / | |
/ `--.| \__/ |
This file contains hidden or 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 UIKit | |
import PlaygroundSupport | |
let stackView = UIStackView() | |
stackView.distribution = .equalSpacing | |
stackView.alignment = .center | |
stackView.translatesAutoresizingMaskIntoConstraints = false | |
let bg = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 500)) | |
bg.backgroundColor = .lightGray |
This file contains hidden or 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
protocol Pokemon { | |
associatedtype PokemonType | |
var name: String { get } | |
var type: PokemonType { get } | |
} | |
struct Electric { | |
// something | |
} |
This file contains hidden or 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 { AsyncStorage } from 'react-native'; | |
export default class GenericAsyncStorage { | |
static async getItem<T>(key: string, callback?: (error?: Error, result?: T) => void): Promise<T> { | |
const item = await AsyncStorage.getItem(key); | |
return JSON.parse(item); | |
} | |
static async setItem<T>( | |
key: string, |
This file contains hidden or 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 * as React from 'react'; | |
import { KeyboardAvoidingView, KeyboardAvoidingViewProps, Platform, View } from 'react-native'; | |
export default class _KeyboardAvoidingView extends React.Component<KeyboardAvoidingViewProps, {}> { | |
render() { | |
if (Platform.OS === 'ios') { | |
return <KeyboardAvoidingView {...this.props} />; | |
} else { | |
return <View {...this.props} />; | |
} |
NewerOlder