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(XML) | |
| require(stringr) | |
| # | |
| # Grabs all names and LinkedIn urls from a Coursera forum thread. Perfect for the "Let's Connect!" threads. | |
| # Usage: | |
| # 1. Open a Coursera forum thread, containing LinkedIn links. | |
| # 2. Scroll all the way to the bottom of the page to load all posts in the thread. | |
| # 3. Save the web page to an html file named post.htm. | |
| # 4. Call linkedInLinks("post.htm") |
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
| doLoop <- function(method, iterations = 1000) { | |
| for (i in 1:iterations) { | |
| method(); | |
| } | |
| } | |
| # Load csv file. | |
| DT <- fread('https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06pid.csv') | |
| # Time option 2. |
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
| #!/bin/bash | |
| appPath=/usr/share/login-image-changer | |
| settingsPath=$appPath/settings.conf | |
| rcLocalPath="/etc/rc.local" | |
| scriptPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| runCommand="sudo bash \"$scriptPath/loginimage.sh\" -r" | |
| settingsExists=0 | |
| install=0 | |
| uninstall=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
| from collections import namedtuple | |
| # These map directly to the 8 regular brainfuck instructions. The | |
| # exception is the offset parameter, which would be 0 in regular | |
| # brainfuck, but can here indicate an offset from the current cell at | |
| # which the operation should be applied. | |
| Add = namedtuple('Add', ['x', 'offset']) | |
| Sub = namedtuple('Sub', ['x', 'offset']) | |
| Right = namedtuple('Right', ['x']) | |
| Left = namedtuple('Left', ['x']) |
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
| /* | |
| grammar.txt: saved from https://gist.github.com/primaryobjects/22363e71112d716ea183 | |
| domain.txt: | |
| (define (domain random-domain) | |
| (:requirements :strips :typing) | |
| (:action op1 | |
| :parameters (?x1 ?x2 ?x3) | |
| :precondition (and (S ?x1 ?x2) (R ?x3 ?x1)) | |
| :effect (and (S ?x2 ?x1) (S ?x1 ?x3) (not (R ?x3 ?x1)))) | |
| (:action op2 |
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 strips = require('strips'); | |
| var util = require('util'); | |
| // Load the domain and problem. | |
| strips.load('./domain-cake.pddl', './problem-cake.pddl', function(domain, problem) { | |
| var S = []; | |
| // S0 - 1 node per literal in initial state. | |
| for (var i in problem.states[0].actions) { | |
| var literal = problem.states[0].actions[i]; |
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
| @echo off | |
| :loop | |
| :: Start timer. | |
| @set /A _tic=%time:~0,2%*3600^ | |
| +%time:~3,1%*10*60^ | |
| +%time:~4,1%*60^ | |
| +%time:~6,1%*10^ | |
| +%time:~7,1% >nul |
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
| 1. Download and install node.js at http://nodejs.org/download/ | |
| 2. Copy your node.js project files to C:\Users\YOUR_USERNAME\Documents\SITENAME | |
| 3. Open Windows Firewall port 80. | |
| 4. Open Windows Powershell and type: | |
| $env:PORT = 80 | |
| cd C:\Users\YOUR_USERNAME\Documents\SITENAME |
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
| /* | |
| html-minifier | |
| https://www.npmjs.com/package/html-minifier | |
| UglifyCSS | |
| https://github.com/fmarcia/UglifyCSS | |
| UglifyJS2 | |
| https://github.com/mishoo/UglifyJS2 |
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
| Razor Syntax for node.js views | |
| https://github.com/kirbysayshi/vash#syntax-example | |
| Example Controller: | |
| exports.page = function(req, res) { | |
| res.render('page.vash', { name: 'John Doe', colors: [ 'red', 'green', 'blue' ] }); | |
| }; | |
| Example Views: |
OlderNewer