by Angel Leon. March 17, 2015;
Last update on December 14, 2023
Updated on February 27, 2023
Updated August 29, 2019.
#!/bin/bash | |
# | |
# 通过对比 ping 响应时间,找到本机最快的上传ip | |
# [email protected] | |
# | |
# 使用方法: | |
# sh -c "$(curl -sSL https://gist.githubusercontent.com/trawor/5dda140dee86836b8e60/raw/turbo-qiniu.sh)" | |
echo "# 这个脚本理论上可以帮你获取任意域名的最快速的IP" | |
echo "# 获取IP列表的服务由 17ce.com 提供, 非常感谢有这么好的免费服务!" |
/// Our custom drop-in replacement `precondition`. | |
/// | |
/// This will call Swift's `precondition` by default (and terminate the program). | |
/// But it can be changed at runtime to be tested instead of terminating. | |
func precondition(@autoclosure condition: () -> Bool, @autoclosure _ message: () -> String = "", file: StaticString = __FILE__, line: UWord = __LINE__) { | |
preconditionClosure(condition(), message(), file, line) | |
} | |
/// The actual function called by our custom `precondition`. | |
var preconditionClosure: (Bool, String, StaticString, UWord) -> () = defaultPreconditionClosure |
- (void)resetCoreData { | |
DDLogInfo(@"[RESET-COREDATA] Started."); | |
[MagicalRecord cleanUp]; | |
NSURL *storeURL = [NSPersistentStore MR_urlForStoreName:kMobilStoreName]; | |
NSURL *walURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-wal"]; | |
NSURL *shmURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-shm"]; | |
#! /bin/sh | |
function print_example() { | |
echo "Example" | |
echo " icons ios ~/AppIcon.pdf ~/Icons/" | |
} | |
function print_usage() { | |
echo "Usage" | |
echo " icons <ios|watch|complication|macos> in-file.pdf (out-dir)" |
// (c) 2014 Nate Cook, licensed under the MIT License | |
/** | |
Returns a tuple with the closest compound fraction possible with Unicode's built-in "vulgar fractions". | |
See here: http://www.unicode.org/charts/PDF/U2150.pdf | |
:param: number The floating point number to convert. | |
:returns: A tuple (String, Double): the string representation of the closest possible vulgar fraction and the value of that string |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.
The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.
Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.
var ids = document.querySelectorAll(".member_id"); | |
var names = document.querySelectorAll(".member_name"); | |
var output = "", length = ids.length; | |
for(var i=0; i<length; i++){ | |
output += ids[i].innerHTML.slice(1,-1) + ":" + names[i].innerHTML + "\n"; | |
} | |
console.log(output); |