Skip to content

Instantly share code, notes, and snippets.

View VincentSit's full-sized avatar

Vincent VincentSit

View GitHub Profile
@VincentSit
VincentSit / gist:30ce863cd18043559ee5
Last active December 9, 2015 10:26
download_instagram_images
# /usr/bin/ruby
# download_instagram_images.rb
require "open-uri"
require "json"
@uid = "260732811"
@access_token = "277504095.59c578a.6aed864be0794247a1c0318221b03d7b"
@url = "https://api.instagram.com/v1/users/#{@uid}/media/recent?access_token=#{@access_token}"
@VincentSit
VincentSit / EOTAliyunOSSClient.h
Last active August 29, 2015 14:07
阿里云 OSS 上传&下载文件。iOS 7+
EOTEXTERN NSString * const EOTAliyunOSSClientErrorDomain;
@interface EOTAliyunOSSClient : NSObject
+ (instancetype)sharedClient;
- (void)getObjectWithPath:(NSString *)path
inBucket:(EOTCloudStorageBucketType)bucket
success:(void (^)(NSData *responseData))success
failure:(void (^)(NSError *error))failure;
@VincentSit
VincentSit / gist:3460151de556ff0b5ef5
Last active July 21, 2016 21:41
Objective-C 编码指南
@VincentSit
VincentSit / VSMedia.h
Created March 27, 2015 08:10
VSMedia.h
//
// VSMedia.h
// rugu
//
// Created by Vincent Sit on 15/1/11.
// Copyright (c) 2015年 Vincent Sit. All rights reserved.
//
#import "VSBaseModel.h"
@VincentSit
VincentSit / VSMedia.m
Created March 27, 2015 08:12
VSMedia.m
//
// VSMedia.m
// rugu
//
// Created by Vincent Sit on 15/1/11.
// Copyright (c) 2015年 Vincent Sit. All rights reserved.
//
#import "VSMedia.h"

我个人属于代码洁癖型选手,个人挑一些小毛病,如下:

1、方法名命名不规范,应该为 - (void)getMatchesListWithHolder:(UIView *)holder success:(void(^)(NSArray *dic))success; ,success 是小写。

2、Block 参数变量名不规范。类型是 NSArray,变量名却写 dic

3、单例命名不规范,单例通常应该命名为 sharedXXX,例如 [NSURLSession sharedSession]

4、回调只有成功回调,没有失败的回调,如果请求失败了,那么回调就不会被执行。

@VincentSit
VincentSit / Batch_ping_yunti_VPN_servers.sh
Last active January 21, 2021 13:29
批量 ping 云梯 VPN 服务器.
#!/bin/bash
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
# 批量 ping 云梯 VPN 服务器.
# 请将 example.com 替换为你的专属服务器地址.
HOSTS=("日本1号:jp1.example.com"
"日本2号:jp2.example.com"
"日本3号:jp3.example.com"
@VincentSit
VincentSit / gist:39406d95514c72816975
Created December 9, 2015 10:24
download instagram image for specific user
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib import request
import json
import os
uid = 260732811
access_token = '277504095.59c578a.6aed864be0794247a1c0318221b03d7b'
base_url = r'https://api.instagram.com/v1/users/%s/media/recent/?access_token=%s' % (uid, access_token)
@VincentSit
VincentSit / nanos.cpp
Created May 9, 2016 17:01 — forked from brysonian/nanos.cpp
get a nanosecond accurate counter for ios and os x
uint64_t nanos() {
static mach_timebase_info_data_t info;
mach_timebase_info(&info);
uint64_t now = mach_absolute_time();
now *= info.numer;
now /= info.denom;
return now;
}
@VincentSit
VincentSit / update_gfwlist.sh
Last active March 24, 2024 14:39
Automatically update the PAC for ShadowsocksX. Only tested on OS X. (Deprecated)
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)