Skip to content

Instantly share code, notes, and snippets.

View btspoony's full-sized avatar
🙃

BT.Wood(Tang Bo Hao) btspoony

🙃
View GitHub Profile
@btspoony
btspoony / JSMin
Created August 31, 2011 10:54
JavaScript Detect Flash Version
window.getFlashVersion = function(){try{try{var axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');try{axo.AllowScriptAccess='always';}catch(e){return'6,0,0';}}catch(e){}return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g,',').match(/^,?(.+),?$/)[1];}catch(e){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1];}}catch(e){}}return'0,0,0';}
@btspoony
btspoony / jsUtility.js
Created November 24, 2011 16:02
Some JS Utility functions
var __sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? __sys.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? __sys.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? __sys.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? __sys.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? __sys.safari = s[1] : 0;
function typeofUndefined(value) {
@btspoony
btspoony / exportAssets.jsflexportAssets.jsfl
Created November 24, 2011 16:06
FLA Exporting JSFL script
fl.outputPanel.clear ();
fl.compilerErrors.clear();
var file_path =
"file:///X:/SNSGameWorkspace/Vineyard/assets/GameDataAssets/MovieClip_fla/";
var output_path =
"file:///X:/SNSGameWorkspace/Vineyard/assets/GameDataAssets/MovieClip_fla/";
var logfile = "file:///X:/QA/Scripts/DailyVersion/GameDataAssetsLog.log";
fl.outputPanel.trace ("[ --------------------- CheckingFiles --------------------- ]");
exportlist=new Array();
checkFolder(file_path,output_path,exportlist,"true","true");
@btspoony
btspoony / UserAuth.js
Created February 28, 2012 21:42
JS Open New Window
var UserAuth = {
openAuth: function(url) {
var top = (document.body.clientHeight - 420) / 2;
var left = (document.body.clientWidth - 520) / 2;
window.open(url, 'connect_window', 'height=400, width=560, toolbar =no, menubar=no, '
+ 'scrollbars=yes, resizable=no,top=' + top + ',left=' + left + ', location=no, status=no');
},
login : function (type) {
switch (type) {
case 'sina':
@btspoony
btspoony / gist:1935356
Created February 28, 2012 21:46
My SocketIO Client Reciever for Flash
/**
* RealTime Server Connection
*/
MainGame.prototype.ioConnect = function() {
if (this.sio) return this.sio;
// Check if io exists
if ( isNULL(io) ) {
console.log('[Error] IO Lib Missing. Please Connect with Website Admin');
@btspoony
btspoony / install-pptpd-for-amazon-ec2.sh
Created May 3, 2012 17:48
[BACKUP] Install PPTPD in EC2
#!/bin/bash
# url: http://pank.org/scripts/
# description: PPTPD install script for Amazon EC2, Tested in Basic 32-bit/64-bit Amazon Linux AMI 2011.02.1 Beta
# comment: csh bash
# platform: linux
#
# You need to open TCP 1723 to allow PPTP dial-in
#
# Version: 0.5
# http://pank.org/blog/2011/08/pptpd-install-for-amazon-ec2.html
@btspoony
btspoony / gist:4583109
Created January 21, 2013 02:02
Monit's upstart config
# This is an event.d (upstart) script to keep monit running.
# To install disable the old way of doing things:
#
# /etc/init.d/monit stop && update-rc.d -f monit remove
#
# then put this script here:
#
# /etc/init/monit.conf
#
# and reload upstart configuration:
@btspoony
btspoony / gitremove
Last active December 29, 2015 23:39
Git Remove bigfiles
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch path/to/your/file' HEAD
git push origin master --force
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
@btspoony
btspoony / filter-chinese-words.py
Last active May 6, 2019 13:36
筛选文件中的中文字符
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test
"""
import sys
import os
import re
import csv
@btspoony
btspoony / go.mod
Created June 24, 2019 07:19
go.mod without x for gfw
replace (
cloud.google.com/go => github.com/GoogleCloudPlatform/google-cloud-go latest
golang.org/x/crypto => github.com/golang/crypto latest
golang.org/x/net => github.com/golang/net latest
golang.org/x/sync => github.com/golang/sync latest
golang.org/x/sys => github.com/golang/sys latest
golang.org/x/text => github.com/golang/text latest
google.golang.org/appengine => github.com/golang/appengine latest
)