Skip to content

Instantly share code, notes, and snippets.

View carlcarl's full-sized avatar

Carl Huang carlcarl

View GitHub Profile

User

  • Appcleaner
  • B1FreeArchiver (unrar)
  • Battery Health
  • BetterTouchTool
  • CCleaner
  • CyberDuck (ftp)
  • DaisyDisk (Disk capacity analyse)
  • Dropbox
@carlcarl
carlcarl / jquery_ie.html
Created February 1, 2013 17:47
jquery 2.0 version with IE
<!--[if lt IE 9]>
<script src="jquery-1.9.0.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="jquery-2.0.0.js"></script>
<!--[endif]-->
@carlcarl
carlcarl / gist:3968352
Created October 28, 2012 11:13
python requests with session
from requests import session
payload = {
'action': 'login',
'username': USERNAME,
'password': PASSWORD
}
with session() as c:
c.post('http://example.com/login.php', data=payload)
@carlcarl
carlcarl / gist:3919264
Created October 19, 2012 16:45
javascript ajax log
console.log = (function(message) {
var original_log = console.log;
return function(message) {
$.post('/log', { message: message });
original_log(message);
}
})();
@carlcarl
carlcarl / coin.c
Created April 12, 2012 19:16
硬幣組合
#include <stdio.h>
int coin(const int coin, const int value)
{
int i, j;
int array[value + 1];
for(j = 1; j < value + 1; j++)
{
array[j] = 0;
}
@carlcarl
carlcarl / gist:1995926
Created March 7, 2012 20:33
javascript text selection
<head>
<script type="text/javascript">
function GetSelectedText () {
if (window.getSelection) { // Firefox, Opera, Google Chrome and Safari
var range = window.getSelection ();
alert (range.toString ());
}
else {
if (document.selection.createRange) { // Internet Explorer
@carlcarl
carlcarl / gist:1336347
Created November 3, 2011 12:13
prependChild and insertAfter
function prependChild(o,s)
{
if(s.hasChildNodes())
{
s.insertBefore(o,s.firstChild);
}
else
{
s.appendChild(o);
}