Skip to content

Instantly share code, notes, and snippets.

@tj
tj / colors.css
Created December 9, 2016 17:09
open-color css modules
/* Gray */
@value gray-0: #f8f9fa;
@value gray-1: #f1f3f5;
@value gray-2: #e9ecef;
@value gray-3: #dee2e6;
@value gray-4: #ced4da;
@value gray-5: #adb5bd;
@value gray-6: #868e96;
@value gray-7: #495057;
@tj
tj / Connector.js
Last active November 26, 2019 15:43
import React from 'react'
const bgStyles = {
strokeWidth: 3,
strokeLinejoin: 'round',
strokeLinecap: 'round',
fill: 'none',
stroke: '#c3fdff'
}
@tj
tj / modules.js
Last active April 9, 2017 19:32
import React from 'react' // export default React
import React, Component from 'react' // first is default, followed by exported
import foo from 'lib' // no default, so just grab all exports
// Maybe there's some reasoning behind the other choices regarding static analysis but
// most of the otheres seem unnecessary. Alternatively just using the destructuring syntax
// would be pretty nice and easier to remember.
function mapDispatchToProps(dispatch) {
return {
checkActions: bindActionCreators(checkActions, dispatch),
statsActions: bindActionCreators(statsActions, dispatch),
settingsActions: bindActionCreators(settingsActions, dispatch)
}
}
.normal {
padding: 5px 25px;
border: 1px solid #eee;
}
.large {
padding: 25px 50px;
composes: normal;
}
@tj
tj / update.js
Last active April 29, 2023 14:53
shouldComponentUpdate utility
let rows = {}
export default function(props = [], state = []) {
return function(target) {
const proto = Object.create(target.prototype)
proto.shouldComponentUpdate = function(newProps, newState) {
let id = (this._update_id = this._update_id || Math.random())
@tj
tj / update.sh
Created February 5, 2016 18:16
Update terraform
update_terraform() {
version=$1
echo "[+] updating terraform to $version"
curl -# -o /tmp/terraform.zip https://releases.hashicorp.com/terraform/$version/terraform_${version}_darwin_amd64.zip
echo "[+] unzipping archive"
unzip /tmp/terraform.zip -d /tmp/terraform
{
"name": "node",
"description": "Node.js example project",
"memory": 128,
"timeout": 5,
"environment": {
"LOGGLY_TOKEN": "123123123123"
}
}
{
"name": "coffeescript",
"description": "Coffeescript example using hooks",
"role": "arn:aws:iam::293503197324:role/lambda",
"runtime": "nodejs",
"hooks": {
"build": "coffee -cs < index.coffee > index.js",
"clean": "rm index.js"
}
}
@tj
tj / lambda.go
Created January 17, 2016 20:25
package main
import (
"encoding/json"
"github.com/apex/apex"
)
type Message struct {
Hello string `json:"hello"`