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
extension NSView { | |
class func loadWithNibNamed(nibNamed: String, loadClass: AnyObject, tag: Int = 0) -> AnyObject? { | |
var topLevelObjects: NSArray? | |
let nib = NSNib(nibNamed: nibNamed, bundle: NSBundle.mainBundle())! | |
nib.instantiateWithOwner(nil, topLevelObjects: &topLevelObjects) | |
for object: AnyObject in topLevelObjects! { | |
if(object.isKindOfClass(loadClass.classForCoder)) { |
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
// | |
// Created by shiweifu on 1/21/15. | |
// Copyright (c) 2015 SF. All rights reserved. | |
// | |
#import "SFResourceManager.h" | |
#import "HexColor.h" | |
@interface SFResourceManager() |
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/env python3 | |
# -*- coding: utf-8 -*- | |
#author: shiweifu <[email protected]> | |
import base64 | |
import argparse | |
def to_base64(data): | |
return base64.b64encode(data).decode() |
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
#include <objc/runtime.h> | |
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace"); | |
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)]; | |
NSLog(@"apps: %@", [workspace performSelector:@selector(allApplications)]); |
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
// | |
// SVHTTPRequest.m | |
// | |
// Created by Sam Vermette on 20.09.11. | |
// Copyright 2011 samvermette.com. All rights reserved. | |
// Modify by shiweifu 2014.7.11 | |
// | |
// https://github.com/samvermette/SVHTTPRequest | |
// |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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/env python | |
# -*- coding: utf-8 -*- | |
from weibo import Client | |
import webbrowser | |
import json | |
def get_token(): | |
try: | |
s = open("token").read() |
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
license |
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
bbbb |
NewerOlder