NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
| //PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012 | |
| //UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler" | |
| //the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist | |
| (function(host) { | |
| function Crawler() { | |
| this.visitedURLs = {}; | |
| }; | |
| # Sample implementation of quicksort and mergesort in ruby | |
| # Both algorithm sort in O(n * lg(n)) time | |
| # Quicksort works inplace, where mergesort works in a new array | |
| def quicksort(array, from=0, to=nil) | |
| if to == nil | |
| # Sort the whole array, by default | |
| to = array.count - 1 | |
| end |
| /* Colloquiate Wireframe Notes Editing Page */ | |
| /* colors | |
| black: #000 | |
| grey: #666 | |
| light grey: #c0c0c0 | |
| blueish grey: #89949B | |
| light pastel yellow: #ffffcc | |
| bisque 3: #CDB79E 205 183 158 | |
| peachpuff 4: #8B7765 139 119 101 |
| <body> | |
| <header></header> | |
| <aside> | |
| <div id="profphoto">Photo</div> | |
| </aside> | |
| <section> | |
| <nav>Theoretical Nav Bar for Docs</nav> | |
| <section id="wrapper"> | |
| <ul> | |
| <li id="docboxleft"></li> |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
| <title>Stripe Sample Form</title> | |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
| <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script> | |
| <script type="text/javascript" src="https://js.stripe.com/v1/"></script> | |
| <script type="text/javascript"> |
| require "rubygems" | |
| require "json" | |
| require "net/http" | |
| require "uri" | |
| uri = URI.parse("http://api.sejmometr.pl/posiedzenia/BZfWZ/projekty") | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| request = Net::HTTP::Get.new(uri.request_uri) |
NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
| #!/usr/bin/env ruby | |
| # 2011-10-10 20:57:53 +1000 | |
| def merge_sort(a) | |
| return a if a.size <= 1 | |
| l, r = split_array(a) | |
| result = combine(merge_sort(l), merge_sort(r)) | |
| end |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Box Shadow</title> | |
| <style> | |
| .box { | |
| height: 150px; | |
| width: 300px; | |
| margin: 20px; |
| import random | |
| class Markov(object): | |
| def __init__(self, open_file): | |
| self.cache = {} | |
| self.open_file = open_file | |
| self.words = self.file_to_words() | |
| self.word_size = len(self.words) | |
| self.database() |