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
| # Given a client_secrets.json file, authenticate via OAuth to the | |
| # Google Drive API and list all files in the account. | |
| # Setup: | |
| ## gem install google-api-client | |
| ## Under Google Developers Console, enable the Drive API and Drive SDK. | |
| ### Under Credentials > OAuth, create a new client ID. | |
| #### This provides the client_secrets.json. | |
| #### The Redirect URI must exactly match what the app actually sends. |
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
| (defrecord Server [service-map] | |
| component/Lifecycle | |
| (start [component] | |
| (info :msg "Starting server.") | |
| (let [server (bootstrap/create-server (:service-map service-map))] | |
| (bootstrap/start server) | |
| (assoc component :server server))) | |
| (stop [component] | |
| (info :msg "Stopping server.") | |
| (update-in component [:server] bootstrap/stop))) |
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
| (require 'sml-mode) | |
| (global-set-key (kbd "C-c S") 'sml-run) | |
| ;; Requires sml binary on PATH... | |
| ;; export PATH=$PATH:/usr/local/smlnj/bin | |
| ;; README | |
| ;; To load a file and run sml repl -> Press C-c C-v inside a sml file. | |
| ;; To run the current files tests -> Press C-c C-r inside a sml file. It assumes the tests are inside the same directory. | |
| ;; For example, If your code file is hw1.sml your test file should be named as hw1test.sml in the same directory |
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 CSS="body { background: #fff; color: #000; font-family: Helvetica, Verdana, sans-serif; } .section { background: #e6b277; padding: 1em; margin: 1em; border: 1px solid #521302; } .example code { display: block; background: #e6d4a5; border: 1px solid #521302; padding: 0.8em; line-height: 1.4em; } #ex1 ul .first { font-size: 1.5em; color: #f0f; }"; | |
| var directChildMatch = CSS.match(/[a-zA-Z0-9\.-_\+\~#\s]*?\>\s?[a-zA-Z0-9\.-_\+\~#]*/gi); | |
| if(directChildMatch) directChildMatch=directChildMatch.join(", "); | |
| alert(directChildMatch); |
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
| from fabric.api import * | |
| APTITUDE_CACHE = set() | |
| PIP_CACHE = set() | |
| EASY_INSTALL_CACHE = set() | |
| def aptitude(package): | |
| aptitude_update() | |
| if package not in APTITUDE_CACHE: |
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
| from fabric.api import * | |
| APTITUDE_CACHE = set() | |
| PIP_CACHE = set() | |
| EASY_INSTALL_CACHE = set() | |
| def aptitude(package): | |
| aptitude_update() | |
| if package not in APTITUDE_CACHE: |
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
| #!/usr/bin/env python | |
| from __future__ import with_statement # needed for python 2.5 | |
| from fabric.api import * | |
| from fabric.contrib.console import confirm | |
| from fabric.contrib import files | |
| USAGE = """ | |
| ================================================================ | |
| NOTE: | |
| using this fabfile expects that you have the python utility |
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
| (defn map-while [f s pred] | |
| (map f (filter pred s))) |
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
| (def coin-values {"h" 50 "q" 25 "d" 10 "n" 5 "p" 1}) | |
| (defn get-range [x cents] | |
| (range (+ 1 (/ cents (coin-values x))))) | |
| (defn list-combos [cents] | |
| (for [h (get-range "h" cents) | |
| q (get-range "q" cents) | |
| d (get-range "d" cents) | |
| n (get-range "n" cents) |
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
| ;; A squad of robotic rovers are to be landed by NASA on a plateau on | |
| ;; Mars. This plateau, which is curiously rectangular, must be | |
| ;; navigated by the rovers so that their on-board cameras can get a | |
| ;; complete view of the surrounding terrain to send back to Earth. | |
| ;; A rover's position and location is represented by a combination of | |
| ;; x and y co-ordinates and a letter representing one of the four | |
| ;; cardinal compass points. The plateau is divided up into a grid to | |
| ;; simplify navigation. An example position might be 0, 0, N, which | |
| ;; means the rover is in the bottom left corner and facing North. |
OlderNewer