An interactive version of a Reingold–Tilford tree. Click on the nodes to expand or collapse.
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 jsdom = require('jsdom'); | |
| var request = require('request'); | |
| var sqlite3 = require('sqlite3').verbose(); | |
| var db = new sqlite3.Database('/home/nathan/webdev/learnnodethetrollway/db/nodetroll.db'); | |
| var util = require('util'); | |
| // Way to have no class, Nate | |
| var CHARACTERS = { |
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
| request.post({url: 'http://www.reddit.com/api/login', | |
| qs: { | |
| username: 'nate', | |
| passwd: 'meta', | |
| api_type: 'json' | |
| }}, | |
| function(error, response, body) { | |
| if (!error && response.statusCode === 200) { | |
| // var mod_hash = body.whatever; | |
| // etc ... |
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 TrollBot = { | |
| mod_hash: undefined, | |
| postComment: function(to_username, text) { | |
| if (!mod_hash) { | |
| // just wait a second | |
| setTimeout(this.postComment, 1000); | |
| } else { | |
| request.post( //.....blah blah blah | |
| ); |
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> | |
| <head> | |
| <title>Interval Shenanigans</title> | |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
| <style> | |
| input { | |
| margin: 20px; | |
| } | |
| </style> |
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
| // Copyright 2010 The Go Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| package main | |
| import ( | |
| "html/template" | |
| "io/ioutil" | |
| "net/http" |
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> | |
| <head> | |
| <style> | |
| p { | |
| -webkit-transition: color 4s ease-in-out; | |
| font-size: 72px; | |
| } | |
| p.greenit { |
The r.concatMap method applies a transformation (defined by the mappingFunction) to each document in the sequence of documents provided, then merges all of the sequences returned by the mappingFunction into a single sequence. This can be used to aggregate collections that are sprinkled across multiple documents for further processing.
Sending emails from a Gmail account using Go can be done using Go's smtp package. Simply:
- Connect to
smtp.gmail.comon port 587, authenticating using your email and password - Optionally, use Go's
text/templatepackage to format theTo,From,Subject, andBodyfields of your email - Use
smtp'sSendMailmethod to actually send the email
An example usage follows. The SmtpTemplateData struct is used to hold the context for the templating mentioned in (2) above.
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 solutions = [ | |
| '192356847643817952875429631584173296761592384239684175458231769926748513317965428', | |
| '359784612821369745764251839247893561698517324513426987485932176976148253132675498', | |
| '359784612821369745764251839547823961698517324213496587485932176976148253132675498' | |
| ]; | |
| function isValidSolution(grid) { | |
| if (typeof grid !== 'string' || grid.length !== 81) { | |
| return false; | |
| } else { |
OlderNewer