Skip to content

Instantly share code, notes, and snippets.

View shayanbo's full-sized avatar

Yanbo Sha shayanbo

View GitHub Profile
@marteinn
marteinn / MSButtonTextTopCell.h
Last active April 26, 2021 04:36
NSButton example: Vertical aligning text in a NSButton
//
// MSButtonTextTopCell.h
// <Project>
//
// Created by Martin Sandström on 2015-09-23.
// Copyright (c) 2015 Martin Sandström. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@trawor
trawor / turbo-qiniu.sh
Last active March 8, 2021 03:21
本脚本解决部分地区七牛上传速度慢的问题
#!/bin/bash
#
# 通过对比 ping 响应时间,找到本机最快的上传ip
# Travis@fir.im
#
# 使用方法:
# sh -c "$(curl -sSL https://gist.githubusercontent.com/trawor/5dda140dee86836b8e60/raw/turbo-qiniu.sh)"
echo "# 这个脚本理论上可以帮你获取任意域名的最快速的IP"
echo "# 获取IP列表的服务由 17ce.com 提供, 非常感谢有这么好的免费服务!"
@ericdke
ericdke / resizeNSImage.swift
Last active March 3, 2023 13:47
Resize NSImage
func resize(image: NSImage, w: Int, h: Int) -> NSImage {
var destSize = NSMakeSize(CGFloat(w), CGFloat(h))
var newImage = NSImage(size: destSize)
newImage.lockFocus()
image.drawInRect(NSMakeRect(0, 0, destSize.width, destSize.height), fromRect: NSMakeRect(0, 0, image.size.width, image.size.height), operation: NSCompositingOperation.CompositeSourceOver, fraction: CGFloat(1))
newImage.unlockFocus()
newImage.size = destSize
return NSImage(data: newImage.TIFFRepresentation!)!
}
@chen206
chen206 / weibo_user_verified_type.md
Last active February 13, 2022 10:20
微博用户认证类型
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)