Skip to content

Instantly share code, notes, and snippets.

Avatar

b123400 b123400

View GitHub Profile
View json.ts
type AsJSON<T> =
T extends Date ? string :
T extends Function ? undefined :
T extends Symbol ? undefined :
T extends Array<any> ? AsJSONArray<T> :
T extends object ? AsJSONObj<T> :
T;
type AsJSONObj<T extends object> = {
[K in keyof T]: AsJSON<T[K]>
View keybase.md

Keybase proof

I hereby claim:

  • I am b123400 on github.
  • I am b123400 (https://keybase.io/b123400) on keybase.
  • I have a public key whose fingerprint is 03A6 8B4D 2A89 4A96 E757 B4DF B9D6 DBC8 3299 4AA6

To claim this, I am signing this object:

View autoblock.py
import tweepy
# fuck you official api key
auth = tweepy.OAuthHandler('3rJOl1ODzm9yZy63FACdg', '5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8')
auth.set_access_token('YOUR-ACCESS-TOKEN', 'YOUR-ACCESS-TOKEN-SECRET')
api = tweepy.API(auth)
def is_bad_follower(follower):
if(follower.default_profile_image and follower.lang == 'zh-cn' and follower.statuses_count < 10):
View gist:5279949
(function(){
if(!window.chrome)return;
var _fillText=CanvasRenderingContext2D.prototype.fillText;
CanvasRenderingContext2D.prototype.fillText=function(text,x,y,maxWidth){
if(text.indexOf(' ')==-1){
return _fillText.apply(this, arguments);
}
var text_arr=text.split('');
var originalX=x;
for(var i=0;i<text_arr.length;i++){
@b123400
b123400 / gist:5040263
Last active Dec 14, 2015
Detect where a font is available. Usage: isFontAvailable("Tahoma") //true
View gist:5040263
var isFontAvailable;
(function(){
var fontCanvas=null,fontCtx=null,cachedWidth={};
isFontAvailable=function(fontFace){
if(!fontCanvas){
fontCanvas=document.createElement('canvas');
fontCtx=fontCanvas.getContext('2d');
}
var stringToMeasure="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var fontsToTest=["monospace","sans-serif","serif"];
@b123400
b123400 / three.php
Created Aug 13, 2012
3HK data usage getter
View three.php
<?php
//There is no public API therefore this is not so reliable, use it at your own risk
function search_string($string , $regex , $index=1){
$pattern = "~".$regex."~";
preg_match($pattern, $string, $matches);
//var_dump($matches);
return $matches[$index];
}
function getDataUsageFromThreeAccount($mobileNo,$password){
$loginURL="http://www.three.com.hk/appCS2/verifyLogin.do?lang=eng";
@b123400
b123400 / gist:938940
Created Apr 23, 2011
まどかとほむほむ
View gist:938940
var madoka= new function{
this.power=/*平凡な中学生の力*/;
this.becomesMahosyoujyo=function (){
/*戦い続ける*/
die();
}
}
var homura = new function() {
this.goBack=function(){
while(true){ //ほむほむ
View gist:915576
-(id)init{
UIMenuItem *customMenuItem = [[[UIMenuItem alloc] initWithTitle:@"Search" action:@selector(searchWord:)] autorelease];
[[UIMenuController sharedMenuController] setMenuItems:[NSArray arrayWithObjects:customMenuItem, nil]];
return [super init];
}
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (tweetContentView.superview != nil) {
if (action == @selector(searchWord:)) {
return YES;
You can’t perform that action at this time.