Function | Shortcut |
---|---|
New Tab | ⌘ + T |
Close Tab or Window | ⌘ + W (same as many mac apps) |
Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
Go to Split Pane by Direction | ⌘ + Option + Arrow Key |
Cycle iTerm Windows | ⌘ + backtick (true of all mac apps and works with desktops/mission control) |
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
// | |
// DispatchQueueScheduler.swift | |
// | |
import Combine | |
import Foundation | |
// DO NOT USE THIS IN PRODUCTION | |
struct DispatchQueueScheduler: Scheduler { | |
let queue: DispatchQueue |
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
// General purpose timer service | |
import Ember from 'ember'; | |
export default Ember.Service.extend({ | |
interval: 5000, | |
// Schedules function `f` to be executed on interval | |
schedule(f, interval) { | |
const time = interval || this.get('interval'); | |
return Ember.run.later(this, function() { |
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
# This demonstrates that, when using async/await, a crash in the task will crash the caller | |
defmodule Tasker do | |
def good(message) do | |
IO.puts message | |
end | |
def bad(message) do | |
IO.puts message | |
raise "I'm BAD!" | |
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
let seconds = 86400*4 + 3600*2 + 65 | |
print(String((seconds / 86400)) + " days") | |
print(String((seconds % 86400) / 3600) + " hours") | |
print(String((seconds % 3600) / 60) + " minutes") | |
print(String((seconds % 3600) % 60) + " seconds") |
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
defmodule MyBlog.Repo.Migrations.CreatePost do | |
use Ecto.Migration | |
def change do | |
create table(:posts, primary_key: false) do | |
add :id, :uuid, primary_key: true | |
add :body, :string | |
add :word_count, :integer | |
timestamps |
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
// utils/computed/search.js | |
import Ember from 'ember'; | |
var computed = Ember.computed; | |
export default function search(dependentKey, propertyKey, searchQueryKey, returnEmptyArray) { | |
returnEmptyArray = (typeof returnEmptyArray === "undefined") ? false : returnEmptyArray; | |
return computed("" + dependentKey + ".@each." + propertyKey, searchQueryKey, function() { | |
var items, query; | |
if (returnEmptyArray && !this.get(searchQueryKey)) { | |
return Ember.A([]); |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.
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
// | |
// OLD AND BUSTED | |
// | |
if ([self.zoomingDelegate respondsToSelector:@selector(zoomingWindow:didZoomOutViewController:)] == YES) | |
{ | |
// Do something important. | |
} | |
// |
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
# Terminal Progress Indicators. Four examples are included: percentage, | |
# spinner, progress bar, and combined. This script has been tested on | |
# Mac OS X 10.8 with Ruby 1.8.7, 1.9.1, 1.9.2, and 1.9.3 | |
class Spinner | |
include Enumerable | |
def each | |
loop do | |
yield '|' | |
yield '/' |