This file contains hidden or 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 selected(){ | |
| var sel = window.getSelection(), | |
| cnt = sel.rangeCount, | |
| ranges=[]; | |
| for(var i = 0; i < sel.rangeCount; i++) | |
| ranges[i] = sel.getRangeAt(i); | |
| return ranges | |
| } | |
| function highlight(node,sels){ |
This file contains hidden or 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
| module | |
| exports #Bool #False #True | |
| def Bool | |
| def False <| Bool | |
| and False -> False | |
| and True -> True | |
| or False -> False | |
| or True -> True |
This file contains hidden or 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
| var url = "http://thenewobjective.com/blog/", | |
| email = /\b[A-Z0-9+_.-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/gi, | |
| delay = 2000, | |
| visited = {}, hostname, | |
| baseDocument = new ActiveXObject("htmlfile"), | |
| a = baseDocument.createElement("a"); | |
| a.href = url; | |
| hostname = a.hostname; |
This file contains hidden or 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
| var qapik = [50,20,10,5,3,1], | |
| usCoins = [25,10,5,1]; | |
| //denominations (ds) must be in descending order | |
| function makeChange(coins,ds){ | |
| var result = {} | |
| for(var i = 0, d = ds[i]; i < ds.length; d = ds[++i]){ | |
| result['n'+d] = Math.floor(coins/d) // a div d | |
| coins = coins % d | |
| } |
This file contains hidden or 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
| var xs = [-4,-3,-7,+2,+1,-1,-4], //[2,1] = 3 | |
| ys = [-2,11,-4,13,-5,-2], //[11,-4,13] = 20 | |
| zs = [5,15,-30,10,-5,40,10,-8] // [...] = 55 | |
| function sum(j,as){ | |
| var max = Math.max; | |
| function tabulate(i,runMax,curMax){ | |
| if(i > j) return curMax | |
| var newMax = max(runMax+as[i],as[i]) | |
| return tabulate(i + 1, newMax, max(curMax,newMax)) |
This file contains hidden or 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 countInversions(xs){ | |
| var count = 0; | |
| function mergeSort(xs){ | |
| var size = xs.length | |
| if (size < 2) return xs | |
| var mid = Math.floor(size / 2), | |
| left = xs.slice(0, mid), | |
| right = xs.slice(mid) |
This file contains hidden or 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
| 04425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E2500000004425248450000000000001E25000000 |
This file contains hidden or 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
| var searchRoot = new System.DirectoryServices.DirectoryEntry( | |
| @"LDAP://server:389/DC=foo,DC=com", | |
| @"DOMAIN\USERNAME", | |
| "PASSWORD" | |
| ){ AuthenticationType = AuthenticationTypes.ReadonlyServer }; | |
| using(var searcher = new System.DirectoryServices.DirectorySearcher(searchRoot)) { | |
| searcher.Filter = "(&(objectCategory=group))"; | |
| var results = searcher.FindAll(); | |
| results.Dump(); |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Click-Through Circle</title> | |
| <style type="text/css"> | |
| html, body{ | |
| margin:0; | |
| padding:0; | |
| } |
This file contains hidden or 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
| module | |
| exports Bool | |
| protocol Bool | |
| False | |
| True | |
| and Bool => Bool | |
| or Bool => Bool | |
| not => Bool |