We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
| <?php | |
| // minimal routing | |
| function web_app($routes, $req_verb, $req_path) { | |
| $req_verb = strtoupper($req_verb); | |
| $req_path = trim(parse_url($req_path, PHP_URL_PATH), '/'); | |
| $found = false; | |
| if (isset($routes[$req_verb])) { |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "sort" | |
| ) | |
| // askForConfirmation uses Scanln to parse user input. A user must type in "yes" or "no" and | |
| // then press enter. It has fuzzy matching, so "y", "Y", "yes", "YES", and "Yes" all count as | |
| // confirmations. If the input is not recognized, it will ask again. The function does not return |
We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist.
Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
| var logStream = { | |
| write: function(message,encoding) { | |
| log.info(message.replace('\n', '')); | |
| } | |
| }; | |
| //Application's configuration | |
| app.configure(function() { | |
| //Your base config methods | |
| #! /usr/bin/env python | |
| """{escher} -- one-file key-value storage. | |
| What? | |
| This is a toy application to manage persistent key-value string data. | |
| The file {escher} is *both* the application and its data. | |
| When you run any of the commands below, the file will be executed and, | |
| after data change, it will rewrite itself with updated data. | |
| You can copy the file with whatever name to create multiple datasets. |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| var data = "do shash'owania"; | |
| var crypto = require('crypto'); | |
| crypto.createHash('md5').update(data).digest("hex"); |
| var phantom = require('phantom'), | |
| vows = require('vows'), | |
| assert = require('assert'); | |
| // nesting tests inside phantom callback so we only | |
| // have to create it once | |
| phantom.create(function(ph) { | |
| var get_page_result = function(url, fn, result) { | |
| ph.createPage(function(page) { |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3" | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "#00002B2B3636" | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "#65657B7B8383" |