Skip to content

Instantly share code, notes, and snippets.

View cp's full-sized avatar
:shipit:

Colby Aley cp

:shipit:
View GitHub Profile
@cp
cp / machine.js
Last active June 29, 2022 18:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions

Keybase proof

I hereby claim:

  • I am cp on github.
  • I am colby (https://keybase.io/colby) on keybase.
  • I have a public key whose fingerprint is AE96 399D B2B3 6EB7 AF4D B83C 8B58 5716 F9E2 ECB0

To claim this, I am signing this object:

/*jshint node:true*/
'use strict';
module.exports = function(/* environment, appConfig */) {
return {
reflect: {
css: '...'
}
};
};
@cp
cp / overrides.md
Last active April 28, 2016 17:53
Reflect Overrides

Reflect Overrides

We built overrides as a way of customizing individual components at runtime. This can be useful for dynamically altering a component based on it's current environment.

Overrides use JSONPath to manipulate your view's configuration. The documentation on JSONPath's syntax can be found here.

Here's an example of supplying Reflect.js with overrides. Specifically, we're setting the dimensions of a component with id #1.

var ui = new ReflectUI(token),

overrides = [

require 'api_cache'
require 'httparty'
APICache.get('testing', cache: 36000) do
'output goes here!'
end
# This is an example of what a lens may look like.
# It is required by Spectacle when the application is started.
class Twitter < Spectacle::Lens
database do
table do |t|
t.name :tweets
t.text :tweet_content
t.integer :favorites
end
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>ReadIt</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<body>
<script>
$.ajax({
@cp
cp / email_parser.rb
Created November 19, 2013 04:45
Simple script for taking a CSV of emails and converting it to something Mail.app likes.
require 'csv'
emails = Array.new
text = File.read('emails.csv').gsub(/\\"/,'""')
CSV.parse(text, headers: true, header_converters: :symbol) do |row|
emails << row[:email]
end
puts emails.join(',')
@cp
cp / hlog
Created November 15, 2013 07:35
A simple and dirty parser for Heroku Logplex. Not well tested.
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
require 'terminal-table'
require 'json'
#
# USAGE: `ruby log.rb [HEROKU_APP_NAME]`
#
# HAIL RUBY
# My response to https://github.com/JacksonGariety/jesus
# Authentication configured through environment variables, per http://rdoc.info/gems/twitter.
require 'twitter'
require 'teller'
loop do
Twitter.unfollow("JacksonGariety")