Skip to content

Instantly share code, notes, and snippets.

Benjamin Keating bkeating

Block or report user

Report or block bkeating

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
@bkeating
bkeating / howto-filemerge-git-osx.md
Created Mar 11, 2010
HOWTO: Using FileMerge (opendiff) with Git on OSX
View howto-filemerge-git-osx.md

HOWTO: Using FileMerge (opendiff) with Git on OSX

FileMerge (opendiff) can really come in handy when you need to visually compare merging conflicts. Other times it's just a nice visual way to review your days work.

The following method works by creating a simple bash script (git-diff-cmd.sh) that sets us up with the proper command line arguments for Git to pass off files to FileMerge.

@bkeating
bkeating / graphiql-dark-mode.css
Created Jan 2, 2019
GraphiQL One Dark Alt (Dark Mode) theme by Ben Keating
View graphiql-dark-mode.css
<style>
/* GraphiQL One Dark Alt (Dark Mode) theme by Ben Keating[1]
* Colors taken from Atom's One Dark theme[2]. Add this file to the end of
* your <head> block to override built-in default styling.
*
* [1]. https://twitter.com/flowpoke
* [2]. https://github.com/atom/atom/tree/master/packages/one-dark-ui
*/
@bkeating
bkeating / wordpress-wxr-example.xml
Created Feb 23, 2011
A vanilla example of the WordPress WXR Schema. Im using this as a starting point to build my own comments importer for disqus.com
View wordpress-wxr-example.xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<item>
<!-- title of article -->
View getBusinessHours.js
import moment from 'moment';
/**
* A business needs to know the hours in which it operates.
*
* Import `getBusinessHours` and get access to:
* - isCurrentlyOPen() - bool on wether or not the cafe is currently open
* - todaysWeekInt() - todays week number. Zero-based (Sunday=0)
* - getDayMeta(int) - returns the given days business hour meta as an object
*
@bkeating
bkeating / cafedb.js
Last active Sep 28, 2018
A cafe menu in the form of a js object
View cafedb.js
module.exports = {
category: [
{ id: 1, title: 'Breakfast', slug: 'breakfast', description: 'Changes Regularly - Febuary 1, 2016', },
{ id: 2, title: 'Lunch', slug: 'lunch', description: 'Changes Regularly - Febuary 1, 2016', },
{ id: 3, title: 'Evening', slug: 'evening', description: 'from 4pm - 8pm Tues. - Sat.', },
{ id: 4, title: 'Wine, Beer, Cocktails', },
{ id: 5, title: 'Sparkling', },
{ id: 6, title: 'Rose', },
{ id: 7, title: 'White', },
{ id: 8, title: 'Red', },
@bkeating
bkeating / coinbase_auth_example.py
Created Aug 5, 2014
GET and POST to Your Coinbase.com account (via API + Secret Key). This is based on the example in their documentation. Adds expires support. Make sure API used has necessary permissions.
View coinbase_auth_example.py
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import hashlib
import hmac
import urllib2
import time
import json
@bkeating
bkeating / index.html
Created Sep 6, 2018
React + JSX + LESSCSS in a single HTML file. No precompiling or bundler necessary. A poor man's JSBin.
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>React + JSX + LESSCSS</title>
<!-- LESS style must come before the actual loading of less.js -->
<style type="text/less">
.container {
width: 90%;
@bkeating
bkeating / index.html
Last active Sep 6, 2018
React + JSX + LESSCSS in a single HTML file. No precompiling or bundler necessary.
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>React + JSX + LESSCSS</title>
<!-- LESS style must come before the actual loading of less.js -->
<style type="text/less">
.container {
width: 90%;
@bkeating
bkeating / userprofile2mailchimp.py
Created Jan 3, 2012
Push Django UserProfile data to an existing MailChimp list
View userprofile2mailchimp.py
"""Iterate over User Profiles and push some fields to MailChimp.
This script assumes you already have a (lenghty) list setup on
mailchimp.com. It also assumes that you have a Django project utilizing
the Auth app and the User object's UserProfile (MemberProfile here).
It's all too custom to drop in and go, but have a look. This is how I
managed to push our Membership data into MailChimp. Learned a bunch of
stuff in the process.
View merge.js
// This works... (returns a merged object)
const combinedFormSchema = this.state.session && _.merge(
this.state.session.building_list[0].schema,
this.state.session.building_list[1].schema
);
// This does not (returns an array of objects, not a merged object)
const combinedFormSchema = this.state.session && _.merge(
_.map(this.state.session.building_list, building => building.schema)
);
You can’t perform that action at this time.