Pure JavaScript Zoom and Pan, taken from http://phrogz.net/tmp/canvas_zoom_to_cursor.html
A Pen by TechSlides on CodePen.
(defn hanoi [n left middle right] | |
(cond | |
(> n 5) (throw (Exception. "No way! This would run far too long!")) | |
(= n 1) (println "Move disc" n "from" left "to" right) | |
:else (do (hanoi (dec n) left right middle) | |
(println "Move disc" n "from" left "to" right) | |
(hanoi (dec n) middle left right)))) | |
(hanoi 5 :left :middle :right) |
Pure JavaScript Zoom and Pan, taken from http://phrogz.net/tmp/canvas_zoom_to_cursor.html
A Pen by TechSlides on CodePen.
var LightenColor = function(color, percent) { | |
var num = parseInt(color,16), | |
amt = Math.round(2.55 * percent), | |
R = (num >> 16) + amt, | |
B = (num >> 8 & 0x00FF) + amt, | |
G = (num & 0x0000FF) + amt; | |
return (0x1000000 + (R<255?R<1?0:R:255)*0x10000 + (B<255?B<1?0:B:255)*0x100 + (G<255?G<1?0:G:255)).toString(16).slice(1); | |
}; |
// source: https://github.com/ldapjs/node-ldapjs/issues/297#issuecomment-137765214 | |
const formatGUID = function (objectGUID) { | |
var data = Buffer.from(objectGUID, 'binary'); | |
// GUID_FORMAT_D | |
var template = '{3}{2}{1}{0}-{5}{4}-{7}{6}-{8}{9}-{10}{11}{12}{13}{14}{15}'; | |
// check each byte | |
for (var i = 0; i < data.length; i++) { |
/* | |
# Convert binary encoded object SID to a string | |
# (eg. S-1-5-21-1004336348-1177238915-682003330-512) | |
# | |
# SID format: https://technet.microsoft.com/en-us/library/cc962011.aspx | |
# | |
# ldapjs `searchEntry` has attribute `raw` that holds the raw | |
# values, including the `objectSid` buffer when one exists. Pass that | |
# buffer to get the string representation that can then be easily | |
# used in LDAP search filters, for example. |
/** | |
* ECMA2015 | |
*/ | |
function convertHex(hexCode,opacity){ | |
var hex = hexCode.replace('#',''); | |
if (hex.length === 3) { | |
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; | |
} |
right_of(X, Y) :- X is Y+1. | |
left_of(X, Y) :- right_of(Y, X). | |
next_to(X, Y) :- right_of(X, Y). | |
next_to(X, Y) :- left_of(X, Y). | |
solution(Street, FishOwner) :- | |
Street = [ | |
house(1, Nationality1, Color1, Pet1, Drinks1, Smokes1), | |
house(2, Nationality2, Color2, Pet2, Drinks2, Smokes2), |