NSTimer
is a great example of an over-verbose, outdated Objective-C API. To run a simple line of code after a delay, you need to write a lot of boilerplate crap.
How about this:
NSTimer.schedule(5.seconds) {
println("Hello world!")
}
Only in /oldrepo: .DS_Store | |
Files /oldrepo/.git/COMMIT_EDITMSG and /newrepo/.git/COMMIT_EDITMSG differ | |
Files /oldrepo/.git/FETCH_HEAD and /newrepo/.git/FETCH_HEAD differ | |
Files /oldrepo/.git/ORIG_HEAD and /newrepo/.git/ORIG_HEAD differ | |
Files /oldrepo/.git/config and /newrepo/.git/config differ | |
Files /oldrepo/.git/fork-settings and /newrepo/.git/fork-settings differ | |
Files /oldrepo/.git/hooks/fsmonitor-watchman.sample and /newrepo/.git/hooks/fsmonitor-watchman.sample differ | |
Files /oldrepo/.git/hooks/pre-commit.sample and /newrepo/.git/hooks/pre-commit.sample differ | |
Files /oldrepo/.git/hooks/pre-push.sample and /newrepo/.git/hooks/pre-push.sample differ | |
Only in /newrepo/.git/hooks: push-to-checkout.sample |
Only in /oldrepo: .DS_Store | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20086 | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20087 | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20088 | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20089 | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20090 | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20091 | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20092 | |
Only in /oldrepo/.git: .watchman-cookie-RadPro.local-1030-20093 | |
Files /oldrepo/.git/COMMIT_EDITMSG and /newrepo/.git/COMMIT_EDITMSG differ |
# Chrome 91 | |
"Uncaught Error: you got Bard" | |
"http://localhost:4000/static/main.1e33ab4c.js" | |
26 | |
11 | |
error.stack = "Error: you got Bard | |
at new Bar (http://localhost:4000/static/main.1e33ab4c.js:26:11) | |
at foo (http://localhost:4000/static/main.1e33ab4c.js:32:3) |
// ModuleGraph/worker/JSFileWrapping.js | |
function normalizeFileName(name) { | |
return '_' + name.replace(/[^a-zA-Z0-9]/g, '_') | |
} | |
function wrapModule( | |
// ... | |
, fileName) { | |
// ... |
// @flow | |
import { map, is } from 'rambdax' | |
import type { DirtyRaw } from '@nozbe/watermelondb/RawRecord' | |
import type { SyncLog } from '@nozbe/watermelondb/sync' | |
// beginning, end, length | |
const censorValue = (value: string): string => | |
`${value.slice(0, 2)}***${value.slice(-2)}(${value.length})` | |
const shouldCensorKey = (key: string): boolean => |
1. set up a Prefetcher instance, for example in your router component | |
2. when you want to display another part of the app, call: | |
``` | |
prefetcher.prefetch(screenConcretePrefetcher, 'my-screen', () => { | |
// prefetch done! you can call setState() or whatever to actually start rendering a tree | |
}) | |
``` |
/* !!! As always: you don't have to translate verbatim. Feel free to change things a bit if it makes more sense in a language, as long as you keep the meaning. */ | |
/* ## new timer view ## */ | |
/* New timer */ | |
"new_timer.title" = "Nuevo temporizador"; | |
/* Go! */ | |
"go.title" = "Iniciar"; | |
/* ## change time view ## */ | |
/* Change time */ | |
"change_time.title" = "Cambiar tiempo"; |
NSTimer
is a great example of an over-verbose, outdated Objective-C API. To run a simple line of code after a delay, you need to write a lot of boilerplate crap.
How about this:
NSTimer.schedule(5.seconds) {
println("Hello world!")
}
import Foundation | |
struct Stream { | |
let string: NSString | |
var position: Int | |
var matchingRange: NSRange { | |
return NSRange(location: position, length: string.length - position) | |
} | |
} |
extension NSRegularExpression { | |
func capturedGroups(forString string: String) -> [String?]? { | |
let nsString = string as NSString | |
let stringRange = NSRange(location:0, length: nsString.length) | |
// Match | |
guard let result = firstMatchInString(string, options: [], range: stringRange) else { | |
return nil | |
} |