Skip to content

Instantly share code, notes, and snippets.

View diyism's full-sized avatar

Malcolm Ke Win diyism

View GitHub Profile
@diyism
diyism / browser.newtab.url
Created July 10, 2012 02:17
firefox about:config
javascript:document.write('<p style="display:inline-block;width:0px;height:100%;vertical-align:middle;"></p><p style="display:inline-block;vertical-align:middle;width:100%;text-align:center;font-weight:bold;color:red;">For DIYism! 2012-12-14</p>');document.close();
@diyism
diyism / gist:3102406
Created July 13, 2012 02:56
count dividable
<?
$group=array();
for ($width=2; $width<=1024-18; ++$width)
{$count=0;
for ($gridWidth=2; $gridWidth<$width; ++$gridWidth)
{if ($width%$gridWidth==0)
{$count=$count+1;
}
}
$group[$count][]=$width;
@diyism
diyism / code block in nested list(markdown example).md
Created October 17, 2012 11:27
code block in nested list(markdown example)

title1

  • sub title1

      <Request>
          <b>jjj</b>
          <Sign_Code>dddd</Sign_Code>
      </Request>
    
  • sub title2

@diyism
diyism / gist:4015990
Created November 5, 2012 08:21
OME 笔记

目录结构:

  • model 实体
  • view 模板
  • controller 控制器
  • script 脚本
  • lib 业务逻辑及库
  • config\config.php,install.lock.php 都是在安装的时候生成的,含数据库账号配置
  • data\kvstore\service和setting 在程序运行的时候生成, kvstore下只要这两个不删系统还能跑起来
  • app\ecredis\crontab\config\defined.php redis账号配置
@diyism
diyism / gist:4167554
Created November 29, 2012 08:24
Firebase Feature reqeust: asynchronous trigger and access control
A simple use case about firebase trigger:
I have a stocks table(tb_stocks):
GoodsID,GoodsNum,Quantity
1,KK0245MM08-804-M,98
2,KK0172YY02-990-L,18
3,KK2104MM681-990-XXL,20
And an orders table(tb_orders):
OrderID,UserName,GoodsID,Quantity,CreateTime
@diyism
diyism / gist:4249425
Created December 10, 2012 08:55
insert tables into firebase
<script src="https://static.firebase.com/v0/firebase.js"></script>
<script>
var ref=new Firebase('https://diyism.firebaseio.com/');
ref.set({'tb_users':{'1':{'username':'Jack','password':'0data!'},
'2':{'username':'Andy','password':'1data!'},
'3':{'username':'Bob','password':'2data!'},
},
'tb_stocks':{'1':{'goods_num':'KK0245MM08-804-M', 'quantity':98},
'2':{'goods_num':'KK0172YY02-990-L', 'quantity':18},
'3':{'goods_num':'KK2104MM681-990-XXL', 'quantity':20}
@diyism
diyism / Personal Blocked Sites in Google Search Result
Created June 7, 2013 05:38
Personal Blocked Sites in Google Search Result
archiveorange.com
mail-archive.com
gmane.org
markmail.org
osdir.com
123cha.com
sosuo.name
71shou.com
pagesinventory.com
okpay.com.cn
@diyism
diyism / dns txt vbs apk downloader
Created June 9, 2013 15:25
用DNS TXT+vbs翻墙脚本(<=1024字节)直接把手机应用送到小白们的电脑上
1.在GAE或HeroKu等具有全球负载均衡(GSLB)的服务商放置apk文件, 比如GAE:
https://d-x-com.appspot.com/x.apk
2.设置d.x.com的DNS TXT记录(日常需要更新其中的IP地址为可用地址,当然在1024字节内可以写得更智能点):
Set r=CreateObject("WinHttp.WinHttpRequest.5.1"):r.open "GET","https://173.194.66.143/x.apk",false:r.option(4)=4096:r.setRequestHeader "Host","d-x-com.appspot.com":r.send():Set m=CreateObject("ADODB.Stream"):m.Type=1:m.Open():m.Write(r.responseBody):m.SaveToFile "x.apk",2
3.在任何地方张贴下面一行代码, 用户在windows dos运行, 就能在所在目录下载到x.apk文件:
nslookup -vc -type=TXT d.x.com 8.8.8.8 | (for /F "tokens=*" %f in ('findstr """"') do @(echo|set /P str=%f)) > a.vbs & a.vbs
@diyism
diyism / cannonau.md
Last active December 23, 2015 10:49
葡萄酒 卡诺纳乌/卡诺娜/卡诺那乌 Cannonau Di Sardegna
@diyism
diyism / android2.2_fixed_and_translateZ_bug
Last active December 24, 2015 19:29
fixed容器内translateZ(0)的元素会导致所有兄弟元素脱离容器的bug(on android 2.2/2.3 browser/webivew)
<script src="zepto.min.js"></script>
<div style="position:fixed;border:1px solid red;" id="pageWrapper">
<div style="z-index:1;top:0px;height:100px;width: 300px;background-color:green; -webkit-transform: translate(0px, 0px) scale(1) translateZ(0);" id="kkkk">kkkkkk</div>
</div>
<script>
$('#kkkk')[0].clientHeight;//relocate #jjjj into #pageWrapper
$('#pageWrapper').append('<div style="background-color:yellow; z-index: 100; height: 7px; position:absolute;top:14px;width:320px;-webkit-transform:translateZ(0);" id="jjjj"></div>');
</script>