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/perl | |
# | |
# Written in 2017 by Kazuho Oku | |
# | |
# To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. | |
# You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | |
# | |
use strict; | |
use warnings; |
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
print("=== signal (hot) ===") | |
do { | |
let (signal, observer) = Signal<Int, NoError>.pipe() | |
let s = signal | |
.map { x -> Int in | |
print("map \(x)") | |
return x | |
} | |
s.observeValues { _ in } |
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 Foundation | |
func dumpMemory(_ p: UnsafeRawPointer, _ size: Int) { | |
let addr = unsafeBitCast(p, to: UInt64.self) | |
var p = p.bindMemory(to: UInt8.self, capacity: size) | |
for i in 0..<size { | |
if i % 8 == 0 { | |
if i != 0 { | |
print() | |
} |
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
# shows all url+titles of Chrome along with front window+tab url+title | |
set titleString to "" | |
tell application "Google Chrome" | |
set window_list to every window # get the windows | |
repeat with the_window in window_list # for every window | |
set tab_list to every tab in the_window # get the tabs | |
repeat with the_tab in tab_list # for every tab |
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
SELECT pods.name, stats_metrics.download_total, stats_metrics.download_week, stats_metrics.app_total, stats_metrics.app_week FROM stats_metrics JOIN pods ON stats_metrics.pod_id = pods.id ORDER BY app_total DESC LIMIT 300; |
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
//: Binary Tree | |
protocol CollectionTypeConvertible { | |
typealias T | |
var array: [T] { get } | |
} | |
class Node<T: Comparable> { | |
let value: T | |
var left: Node? |
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
// | |
// Device.swift | |
// imHome | |
// | |
// Created by Kevin Xu on 2/9/15. Updated on 6/20/15. | |
// Copyright (c) 2015 Alpha Labs, Inc. All rights reserved. | |
// | |
import Foundation |
Upgrading to Lion or Yosemite and WebStorm 9, I noticed key repeat was
turned off for the IdeaVim plugin h j k l keys.
defaults write -g ApplePressAndHoldEnabled -bool false
in a terminal will enable
key repeat for every app. This can alternatively be found in the accessibility
settings in OS X' preferences.
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
curl -i -u "my_user_name:my_password" -X PUT -d '' 'https://api.github.com/repos/my_gh_userid/my_repo/collaborators/my_collaborator_id' |
NewerOlder