This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>DOM selection jQuery-ish on IE8+</title> | |
</head> | |
<body> | |
<script> | |
window.$ = function(selector) { | |
return document.querySelector(selector); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os, codecs, sys | |
dir = os.getcwd() | |
file = sys.argv[1] | |
Dict = [['a', 'b'], ['c', 'd']] | |
fname = os.path.join(dir, file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -R /path | awk ' | |
/:$/&&f{s=$0;f=0} | |
/:$/&&!f{sub(/:$/,"");s=$0;f=1;next} | |
NF&&f{ print s"/"$0 }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error_reporting(E_ALL); | |
ini_set("display_errors", "on"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function randomStringFromCharacterSet($length, $possibleCharacters){ | |
return substr(str_shuffle(str_repeat($possibleCharacters,$length)),0,$length); | |
} | |
//Example of usage | |
$possibleCharacters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
$length = 5; | |
for($i=0;$i<10;$i++){ | |
echo randomStringFromCharacterSet($length, $possibleCharacters).'</br>'; |
NewerOlder