Skip to content

Instantly share code, notes, and snippets.

TJ Holowaychuk tj

Block or report user

Report or block tj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.go
package main
import (
"fmt"
"net/http"
"github.com/apex/go-apex"
"github.com/apex/go-apex/proxy"
)
@tj
tj / Makefile
Last active Mar 11, 2017
imgix favicons
View Makefile
IMAGE_CDN = https://apex-inc.imgix.net
# Imgix image replacement.
images:
@echo "==> pointing images to $(IMAGE_CDN)"
@find build -type f -name "*.html" | xargs sed -i '' 's|src="/images|src="$(IMAGE_CDN)/images|g'
@find build -type f -name "*.html" | xargs sed -i '' 's|href="/images|href="$(IMAGE_CDN)/images|g'
.PHONY: images
View icons.sh
show_icons() {
defaults write com.apple.finder CreateDesktop true
killall Finder
}
hide_icons() {
defaults write com.apple.finder CreateDesktop false
killall Finder
}
@tj
tj / colors.css
Created Dec 9, 2016
open-color css modules
View colors.css
/* 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;
View Connector.js
import React from 'react'
const bgStyles = {
strokeWidth: 3,
strokeLinejoin: 'round',
strokeLinecap: 'round',
fill: 'none',
stroke: '#c3fdff'
}
View modules.js
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.
View dispatch.js
function mapDispatchToProps(dispatch) {
return {
checkActions: bindActionCreators(checkActions, dispatch),
statsActions: bindActionCreators(statsActions, dispatch),
settingsActions: bindActionCreators(settingsActions, dispatch)
}
}
View some.css
.normal {
padding: 5px 25px;
border: 1px solid #eee;
}
.large {
padding: 25px 50px;
composes: normal;
}
@tj
tj / update.js
Last active Dec 28, 2018
shouldComponentUpdate utility
View update.js
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 Feb 5, 2016
Update terraform
View update.sh
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
You can’t perform that action at this time.