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 | |
class DemoModel : ObservableObject { | |
enum State { | |
case value(Date) | |
} | |
@Published var counter = 0 | |
@Published var state = State.value(Date()) |
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 | |
# Create and open a file from the shell using simple templates | |
# https://gist.github.com/ralfebert/cdc30dbc9d2c2356d8f9b6b7c1492888/edit | |
require 'date' | |
require 'shellwords' | |
require 'ostruct' | |
require 'optionparser' |
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
func arrayWith(count: Int, sum : Int) -> [Int] { | |
assert(count >= 1) | |
var result = [sum] | |
while result.count < count { | |
let randomIndex = result.indices.randomElement()! | |
let v = Int.random(in: 0...result[randomIndex]) | |
result[randomIndex] -= v | |
result.append(v) | |
} | |
return result |
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 python | |
import os | |
import sys | |
import subprocess | |
import shutil | |
import json | |
import re | |
import time | |
from distutils.spawn import find_executable |
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 CoreGraphics | |
import CoreImage | |
func imageMetadataString(image: CGImage) -> String { | |
return "\(image.width)x\(image.height) bitsPerComponent:\(image.bitsPerComponent) bytesPerRow:\(image.bytesPerRow) bitsPerPixel:\(image.bitsPerPixel)" | |
} | |
/** | |
@brief Returns the maximum difference of pixel values in the image. | |
@discussion Assumes doImagesHaveSameMeta has already returned true on |
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 | |
require 'nokogiri' | |
def show_usage(msg = nil) | |
puts "#{msg}\n\n" if msg | |
puts "Usage:\n\t#{$PROGRAM_NAME} [storyboard_file]" | |
exit(0) | |
end |
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 | |
require 'fileutils' | |
require 'xcodeproj' | |
unless ARGV.count == 2 | |
puts "Usage: xcode_set_development_region.rb [project] [region]" | |
exit(1) | |
end |
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 5366b677f1f7a1053de5904f96ba5108ffaf8953 Mon Sep 17 00:00:00 2001 | |
From: Ralf Ebert <info@ralfebert.de> | |
Date: Thu, 7 May 2015 23:33:01 +0200 | |
Subject: [PATCH] Fix for #844: Incompatibility haml (4.0.6) -> sprockets | |
(3.0.3) causing error 'wrong number of arguments' for inline :sass filter in | |
haml template | |
--- | |
lib/haml/sass_rails_filter.rb | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) |
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
// | |
// Swift-KVO | |
// | |
// Created by Jim Correia on 6/5/14. | |
// Copyright (c) Jim Correia. All rights reserved. | |
// | |
// Update: 6/17/2014 | |
// | |
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context |
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
git config --global alias.lg "log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr %an)%Creset' --abbrev-commit --date=relative" |