Author: Chris Lattner
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
def record(name, fields=''): | |
fields = fields.split() | |
class cls: | |
def __init__(self, *args): | |
for key, value in zip(fields, args): | |
self.__dict__[key] = value | |
def __repr__(self): | |
return '%s(%s)' % (name, ', '.join(repr(self.__dict__[key]) for key in fields)) | |
cls.__name__ = name | |
return cls |
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 Cocoa | |
import MetalKit | |
@NSApplicationMain | |
class AppDelegate: NSObject, NSApplicationDelegate, MTKViewDelegate { | |
weak var window: NSWindow! | |
weak var metalView: MTKView! | |
let device = MTLCreateSystemDefaultDevice()! | |
var commandQueue: MTLCommandQueue! | |
var pipelineState: MTLRenderPipelineState! |
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
FROM rustlang/rust:nightly as builder | |
WORKDIR /app/src | |
RUN USER=root cargo new --bin ht | |
COPY Cargo.toml Cargo.lock ./ht/ | |
WORKDIR /app/src/ht | |
RUN cargo build --release | |
COPY ./ ./ | |
RUN cargo build --release |
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
// | |
// MovieRecorder.swift | |
// RosyWriter | |
// | |
// Translated by OOPer in cooperation with shlab.jp, on 2015/1/17. | |
// | |
// | |
// | |
/* | |
Copyright (C) 2016 Apple Inc. All Rights Reserved. |
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
// | |
// Capture.swift | |
// DemoVIdeoRecordingAndFirebase | |
// | |
// Created by Redditor :D on 02/04/2017. | |
// | |
import UIKit | |
import AVKit | |
import AVFoundation |
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 Firebase | |
extension DataSnapshot { | |
func toObject<T:Codable>() throws -> T { | |
var newValue = value as! [String: Any] | |
newValue["uid"] = key | |
let data = try! JSONSerialization.data(withJSONObject: newValue, options: .sortedKeys) | |
return try JSONDecoder().decode(T.self, from: data) | |
} |
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/python3 | |
import turtle | |
#the number of digits to use | |
numDigits = 1000000 | |
changeColorInc = numDigits / 10 | |
colors = iter(["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#551A8B"]) | |
#scale = 0.99 1k | |
#scale = 0.199#10k |
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
from __future__ import division | |
from random import random | |
import numpy as np | |
import pandas as pd | |
''' | |
Use regret-matching algorithm to play Scissors-Rock-Paper. | |
''' | |
class RPS: |
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 UIKit | |
import SnapKit | |
class ViewController: UIViewController { | |
var scrollView: UIScrollView! | |
var stackView: UIStackView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |