Skip to content

Instantly share code, notes, and snippets.

@joshski
joshski / index.js
Created January 30, 2015 23:12
requirebin sketch
var plastiq = require('plastiq');
var h = plastiq.html;
function render(model) {
return h('article', h('.title', {
onblur: function(e) {
model.title = e.target.innerText.replace(/\n/g, "");
e.target.innerHTML = '<h1>' + model.title + '</h1>';
},
attributes: { contenteditable: true }},
@joshski
joshski / index.js
Created January 27, 2015 10:18
requirebin sketch
var plastiq = require('plastiq');
var h = plastiq.html;
var pogo = require('pogo');
var code = "h 'h1' 'Edit me'";
function render(model) {
return h('div',
h('textarea', {
style: textAreaStyle,
binding: [model, 'code'],
@joshski
joshski / plastiq-pogo-repl.js
Last active August 29, 2015 14:14
Plastiq/Pogo REPL
var plastiq = require('plastiq');
var h = plastiq.html;
var pogo = require('pogo');
var code = "h 'h1' 'Edit me'";
function render(model) {
return h('div',
h('textarea#read', {
style: textAreaStyle,
binding: [model, 'code'],
@joshski
joshski / index.js
Last active August 29, 2015 14:14 — forked from refractalize/index.js
REPL
// a little pogo/plastiq REPL
var plastiq = require('plastiq');
var h = plastiq.html;
var pogo = require('pogo');
var example = "h 'h1' 'Edit me!'";
function render(model) {
return h('div',
h('textarea', { style: textAreaStyle, binding: [model, 'code'] }),
@joshski
joshski / resize-icons.rb
Last active August 29, 2015 14:12
Resize icons for ios
# ruby resize.rb <path-to-hi-res-icon>
[29,40,58,76,80,87,120,156,180].each do |n|
`convert "#{ARGV[0]}" -resize #{n}x#{n} "#{n}.png"`
end
@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) {
@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
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 / 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 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);