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
Do.ready("tmpl", "share", function () { | |
var f = $("body"), | |
b = f.attr("data-cover").split(","), | |
h = 0, | |
a = $("#summary-2011"), | |
d = $("#summary-hd"), | |
g = $("#summary-bd"), | |
c = $("#summary-ft"); | |
$.fn.resortMovie = function () { | |
$(this).one("click", function (m) { |
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
function new() { | |
// set default screen, pen and turtle values | |
setbg(0, 0, 0); | |
setpc(0, 1, 0); | |
setpw(1); | |
pu(); | |
} | |
function ang_col(theta) { | |
return abs(255 * cos(theta)); |
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
_CONTENT_TYPES = { '.png': 'image/png', '.gif': 'image/gif', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.jpe': 'image/jpeg' } | |
def _encode_multipart(**kw): | |
''' | |
Build a multipart/form-data body with generated random boundary. | |
''' | |
boundary = '----------%s' % hex(int(time.time() * 1000)) | |
data = [] | |
for k, v in kw.iteritems(): | |
data.append('--%s' % boundary) |
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
/** | |
* CJK/Western text emphasis | |
*/ | |
@font-face { | |
font-family: "Western Italic"; | |
src: local("HoeflerText-Italic"), | |
local("Baskerville-Italic"), | |
local("Georgia Italic"); | |
font-style: normal; |
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
embedImages = (cssPath) -> | |
imgRegex = /url\s?\(['"]?(.*?)(?=['"]?\))/gi | |
css = fs.readFileSync cssPath, 'utf-8' | |
while (match = imgRegex.exec css) | |
imgPath = path.join path.dirname(cssPath), match[1] | |
try | |
img = fs.readFileSync imgPath, 'base64' | |
ext = imgPath.substr imgPath.lastIndexOf('.') + 1 | |
css = css.replace match[1], "data:image/#{ext};base64,#{img}" | |
catch e |
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
/** | |
* Escape the given string of `html`. | |
* | |
* @param {String} html | |
* @return {String} | |
* @api private | |
*/ | |
exports.escape = function escape(html){ | |
return String(html) |
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
import re | |
import htmlentitydefs | |
def unescape(text): | |
def fixup(m): | |
text = m.group(0) | |
if text[:2] == "&#": | |
# character reference | |
try: | |
if text[:3] == "&#x": |
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
(defn binary-search [items value] | |
(letfn | |
[(do-search | |
[items offset] | |
(let [/ (comp long /) | |
mid (/ (dec (count items)) 2) | |
mid-value (items mid)] | |
(cond | |
;; found | |
(= value mid-value) (+ offset mid) |
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
(defn nth-root | |
[x n] | |
(Math/pow Math/E (/ (Math/log x) n))) | |
(defn sum-of-powers | |
[sum n start] | |
(let [upper-bound (int (inc (nth-root sum n)))] | |
(->> (range start (inc upper-bound)) | |
(map | |
(fn [x] |
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
diff --git a/src/DLD-FUNCTIONS/rand.cc b/src/DLD-FUNCTIONS/rand.cc | |
index 0602379..cdad2e2 100644 | |
--- a/src/DLD-FUNCTIONS/rand.cc | |
+++ b/src/DLD-FUNCTIONS/rand.cc | |
@@ -26,11 +26,7 @@ along with Octave; see the file COPYING. If not, see | |
#endif | |
#include <ctime> | |
-#if defined (HAVE_UNORDERED_MAP) | |
#include <unordered_map> |
OlderNewer