ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null
brew cask install visual-studio-code
// plain write to image | |
@discardableResult func writeCGImage(_ image: CGImage, to destinationURL: URL) -> Bool { | |
guard let destination = CGImageDestinationCreateWithURL(destinationURL as CFURL, kUTTypePNG, 1, nil) else { return false } | |
CGImageDestinationAddImage(destination, image, nil) | |
return CGImageDestinationFinalize(destination) | |
} | |
// There's a panel, save image png |
#!/usr/bin/env node | |
console.log('yay gist') |
disabled_rules: # rule identifiers to exclude from running | |
- variable_name | |
- nesting | |
- function_parameter_count | |
opt_in_rules: # some rules are only opt-in | |
- control_statement | |
- empty_count | |
- trailing_newline | |
- colon | |
- comma |
Notes for Creating a Cocoa Pod | |
Pod Version: 0.39.0 | |
OS: OS X El Capitain (10.11.3) | |
- - - - - - - - - - - - - - - - - - - - - - - | |
1. Install CocoaPods (https://guides.cocoapods.org/using/getting-started.html) | |
2. Create Xcode project to author the Pod |
A common task when developing iOS apps is to register custom cell subclasses for both UITableView
and UICollectionView
. Well, that is if you don’t use Storyboards, of course.
Both UITableView
and UICollectionView
offer a similar API to register custom cell classes:
public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
<?php | |
$deviceToken = '6e1326c0e4758b54332fab3b3cb2f9ed92e2cd332e9ba8182f49027054b64d29'; // iPad 5s Gold prod | |
$passphrase = ''; | |
$message = 'Hello Push Notification'; | |
$ctx = stream_context_create(); | |
stream_context_set_option($ctx, 'ssl', 'local_cert', 'pushcert.pem'); // Pem file to generated // openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts // .p12 private key generated from Apple Developer Account | |
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase); | |
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); // production | |
// $fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); // developement |