This file contains hidden or 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
| function cdf | |
| cd (finder_path ) | |
| end | |
| function finder_path | |
| echo ' | |
| tell application "Finder" | |
| if (1 <= (count Finder windows)) then | |
| get POSIX path of (target of window 1 as alias) | |
| else |
This file contains hidden or 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
| """ | |
| 1Password is good at a lot of things. Importing CSV is not one of them (as of 5.5.BETA-29). | |
| Converts a Meldium CSV to something 1Password will import correctly. | |
| To export: http://support.meldium.com/knowledgebase/articles/656755-export-meldium-data-to-a-spreadsheet | |
| """ | |
| import csv | |
| import sys |
This file contains hidden or 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
| pg() { | |
| if [[ $@ == "log" ]]; then | |
| command less /usr/local/var/postgres/default/server.log | |
| elif [[ $@ == "start" || $@ == "stop" || $@ == "restart" ]]; then | |
| command pg_ctl -D /usr/local/var/postgres/default -l /usr/local/var/postgres/default/server.log $@ | |
| else | |
| echo "Wrong pg command!" | |
| fi | |
| } |
This file contains hidden or 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
| // | |
| // CLLocation+Sino.h | |
| // | |
| // Created by i0xbean@gmail.com on 13-4-26. | |
| // 火星坐标系转换扩展 | |
| // | |
| // earth(国外 WGS84), mars(国内 GCJ-02), bearPaw(百度 BD-09) 坐标系间相互转换 | |
| // 未包含 mars2earth. 需要这个可参考 http://xcodev.com/131.html | |
| #import <CoreLocation/CoreLocation.h> |
This file contains hidden or 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/env python | |
| import sys | |
| import json | |
| import base64 | |
| import urllib2 | |
| liveURL = 'https://buy.itunes.apple.com/verifyReceipt' | |
| sandboxURL = 'https://sandbox.itunes.apple.com/verifyReceipt' |
This file contains hidden or 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 is a modification of the blogpost on how to use Mongoid and Sinatra. | |
| # Here is the original blogpost http://www.garrensmith.com/2010/09/11/Mongoid-sinatra.html | |
| # The modification lets you use Mongoid 3.0 with the new Moped driver | |
| # The new Moped driver uses the Sessions component to define the MongoDB connection rather | |
| # than the Mongo::Connection.new that is used in the case of the default Ruby driver. | |
| # Moped::Session.new vs Mongo::Connection.new | |
| # Mongoid.load!(yaml_config.yml) is used to build the config hash. Alternatively, the hash can | |
| # be built manually by using Mongoid.config {|config| ...} syntax. The config.sessions hash |
This file contains hidden or 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
| /// Withable is a simple protocol to make constructing | |
| /// and modifying objects with multiple properties | |
| /// more pleasant (functional, chainable, point-free) | |
| public protocol Withable { | |
| init() | |
| } | |
| public extension Withable { | |
| /// Construct a new instance, setting an arbitrary subset of properties | |
| init(with config: (inout Self) -> Void) { |
This file contains hidden or 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/env python | |
| """ | |
| A pure python ping implementation using raw socket. | |
| Note that ICMP messages can only be sent from processes running as root. | |
| Derived from ping.c distributed in Linux's netkit. That code is |
This file contains hidden or 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 Photos; | |
| [PHPhotoLibrary requestAuthorizationForAccessLevel:PHAccessLevelReadWrite handler:^(PHAuthorizationStatus status) { | |
| NSLog(@"PHAuthorizationStatus: %ld", status); | |
| PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init]; | |
| fetchOptions.includeHiddenAssets = YES; | |
| fetchOptions.includeAllBurstAssets = YES; | |
| PHFetchResult<PHAsset *> *result = [PHAsset fetchAssetsWithOptions:fetchOptions]; |
This file contains hidden or 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
| static BOOL PSPDFIsDevelopmentBuild(void) { | |
| #if TARGET_IPHONE_SIMULATOR | |
| return YES; | |
| #else | |
| static BOOL isDevelopment = NO; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| // There is no provisioning profile in AppStore Apps. | |
| NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]]; | |
| if (data) { |
OlderNewer