Skip to content

Instantly share code, notes, and snippets.

View SketchSystems.spec
Deploybot
running
pause -> paused
continue -> running
stop -> stopped
paused
pause -> paused
continue -> running
stop -> stopped
View button.js
// 1. Second dynamic argument — first is "guarenteed" to not interpolate
const Button = styled.button(`
/* Adapt the colors based on primary prop */
font-size: 1em;
margin: 1em;
padding: 0.25em 1em;
border: 2px solid palevioletred;
border-radius: 3px;
`, (props) => `
View button.js
const Button = styled.button`
/* Adapt the colors based on primary prop */
background: ${props => window.innerWidth < 1000 ? 'palevioletred' : 'white'};
color: ${props => window.innerWidth < 1000 ? 'white' : 'palevioletred'};
font-size: 1em;
margin: 1em;
padding: 0.25em 1em;
border: 2px solid palevioletred;
border-radius: 3px;
View cssmodules.ohm
Arithmetic {
Exp
= ComposeExp ("," ComposeExp ) * end
ComposeExp
= exportIdent + Source ?
Source
= "from" url
View bench.sh
#!/bin/bash
i="0"
while [ $i -gt -1 ]
do
i=$[$i+1]
echo $i
(
node bot.js ws://localhost:5000
View random.js
var WebSocket = require('ws')
var ws = new WebSocket('ws://localhost:5000')
function rand(lim) {
return Math.floor(Math.random(lim) * lim)
}
function sample(col) {
return col[rand(col.length)]
View react-css-modules-example.js
function cssmodularize(strings) {
/* TODO: Un-stub */
return {
'.foo': 'Button-foo-abcd'
}
}
class Button {
static styles = cssmodularize`
View gist:24d4e23c350fe3e833d4
/*
This file was autogenerated from Meta's CSS. I tried getting
postcss-for working but it turns out it's a massive PITA. /shrug
~ @chrislloyd
*/
@media (--breakpoint-sm) {
.sm-m0 { margin: 0 }
.sm-mt0 { margin-top: 0 }
.sm-mr0 { margin-right: 0 }
@chrislloyd
chrislloyd / whitespace.rb
Created May 5, 2015
BASS Responsive whitespace helpers
View whitespace.rb
# ruby whitespace.rb | pbcopy
%w(sm md lg).each do |breakpoint|
puts "@media (--breakpoint-#{breakpoint}) {"
{
0 => ['0', '0'],
1 => ['var(--space-1)', 'calc(0 - var(--space-1))'],
2 => ['var(--space-2)', 'calc(0 - var(--space-2))'],
3 => ['var(--space-3)', 'calc(0 - var(--space-3))'],
View nonoptimistic.js
// in this version, the user clicks the button, the request is sent to the server and the number of upvotes
// is only updated when the response comes back
handleClick: function(e) {
e.preventDefault();
this.upvote();
},
upvote: function() {
// Not sure what the state name is here, just need this to toggle the button immediately