Skip to content

Instantly share code, notes, and snippets.

@joshski
joshski / react-component.pogo
Last active August 29, 2015 13:56
React component in pogo
module.exports = {
render () =
div (
h1 { id = 'main_heading' } (props.heading)
p (props.introduction)
)
}
@joshski
joshski / bad-hint-paths.ps1
Last active October 12, 2017 08:26
Find bad hint paths in csproj files
get-childitem . -include *.csproj -rec | select-string -pattern "<HintPath>[^<]+</HintPath>" | % { $_ -replace '</?HintPath>',"" } | % { write-host $_; $_ } | % { $_ -replace '[^\\]*.csproj:\d+:',"" } | % { $_ -replace '\s+','' } | % { resolve-path $_ }
@joshski
joshski / git-flow
Created March 18, 2014 11:52
My Git flow (am I weird?)
git checkout master
git pull origin master
[run tests]
[write failing test]
[make test pass]
git checkout -b feature_x
git add .
git commit -m "Feature X"
[refactor]
[run tests]
@joshski
joshski / monitor.html
Created March 25, 2014 17:42
Monitor remote websites, in style
<html>
<body>
<h1 id="heading"></h1>
<iframe id="frame" src="about:blank" style="width: 100%; height: 100%"></iframe>
<script type="text/javascript">
var urls = [
'http://httpbin.org/status/418',
<script>
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event)
{
alert("RECEIVED!");
if (event.origin !== "http://localhost:3000")
return;
@joshski
joshski / index.js
Created November 20, 2014 10:34
requirebin sketch
var code = '[w <- ["happy", "days"], w].join " "'
var js = require('pogo').compile(code, { inScope: false })
document.body.innerHTML += eval(js);
@joshski
joshski / beefy-pogo.sh
Last active August 29, 2015 14:10
Beefy Pogo
mkdir beefy-test
cd beefy-test
npm init
npm install pogo watchify pogoify cssify beefy -save
echo "* { color: red }" > index.css
echo "require './index.css'" > index.pogo
echo "document.body.innerHTML = 'Featurist FTW'" >> index.pogo
beefy index.pogo -- -t pogoify -t cssify
@joshski
joshski / index.js
Created November 25, 2014 15:18
css-to-xpath example
var cssToXPath = require('css-to-xpath');
document.body.innerHTML = cssToXPath('p:not(:has(a.x))');
@joshski
joshski / index.js
Created December 12, 2014 09:58
requirebin sketch
var code = ['item = 0', 'do', ' print (item)', ' item := item + 1', 'while @{ item < 10 }']
try {
var js = require('pogo').compile(code.join("\n"), { inScope: false })
document.body.innerHTML += js;
} catch (e) {
document.body.innerHTML += e.toString();
}
@joshski
joshski / index.js
Last active August 29, 2015 14:12
requirebin sketch
var plastiq = require('plastiq');
var h = plastiq.html;
var bind = plastiq.bind;
function render(model) {
return h('div',
h('input',
{
type: 'file',
model: function (file) {