Skip to content

Instantly share code, notes, and snippets.

View billinghamj's full-sized avatar
🏳️‍🌈
👀

James Billingham billinghamj

🏳️‍🌈
👀
View GitHub Profile
@billinghamj
billinghamj / gist:5347498
Created April 9, 2013 17:12
A better way to declare lots of font-faces
@import 'compass/css3/font-face';
@mixin nice-font-face($name, $directoryName, $svg, $weights, $style, $fileSuffix: '', $nameOverride: false)
{
@each $weight in $weights
{
$path: $directoryName + '/';
$files: '';
@if ($nameOverride)
@billinghamj
billinghamj / numeric.rb
Created September 14, 2013 00:46
Extension of Numeric with generic data retrieval. Currently limited to pricing from Amazon.
require 'httparty'
require 'nokogiri'
class PlauralObject
def initialize(name, number)
@name = name
@number = number
end
def cost
@billinghamj
billinghamj / gist:6709374
Created September 26, 2013 03:07
More Obj-C like version of an SO answer - http://stackoverflow.com/a/4251473/743957
#import <objc/runtime.h>
- (BOOL) class:(Class)classA descendsFromClass:(Class)classB
{
while (1)
{
if (classA == classB) return true;
id superClass = class_getSuperclass(classA);
if (classA == superClass) return (superClass == classB);
classA = superClass;
#import "UIViewController+UniversalModal.h"
@implementation UIViewController (UniversalModal)
- (void)presentViewControllerFromVisibleViewController:(UIViewController *)viewControllerToPresent
animated:(BOOL)animated
completion:(void (^)(void))completion
{
if ([self isKindOfClass:[UINavigationController class]])
@billinghamj
billinghamj / 1-MyClass.mm
Last active August 29, 2015 14:03
Object Oriented bridging through C
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, BatteryStatus)
{
BatteryStatusUnknown,
BatteryStatusOkay,
BatteryStatusLow,
BatteryStatusEmpty
};
@billinghamj
billinghamj / twilio.js
Created August 30, 2015 18:32
Twilio async/await
const express = require('express');
const twilio = require('twilio');
const app = express();
app.use('/twilio', twilio.middleware);
const call = await twilio.call.create('+12125551234', { from: '+16465551234' });
call.say('Welcome to Cuvva');
@billinghamj
billinghamj / user-stylesheet.css
Created September 27, 2015 08:51
Disable custom fonts
*:not([class*=icon]) {
font-family: inherit;
}
html {
font-family: sans-serif !important;
}
tt, code, kbd, samp, pre, xmp, plaintext, listing {
font-family: monospace !important;
@billinghamj
billinghamj / storage.js
Created March 30, 2016 08:54
Light MongoDB Abstraction
import log from 'cuvva-log';
import {MongoClient, ObjectID} from 'mongodb';
export default class Storage {
static async create(url) {
// for this particular service, majority is worth having
// if copying, evaluate your write concern needs properly
const db = await MongoClient.connect(url, {
db: { w: 'majority' },
});
@billinghamj
billinghamj / main.go
Created April 6, 2016 11:38
Go JWT Generator - ES512 with OpenSSL PEM format keys
package main
import (
"crypto"
"crypto/x509"
"encoding/pem"
"fmt"
"github.com/dgrijalva/jwt-go"
"io/ioutil"
"time"

Keybase proof

I hereby claim:

  • I am billinghamj on github.
  • I am billinghamj (https://keybase.io/billinghamj) on keybase.
  • I have a public key ASAQvSgKR433Yc-RZa6Hdh33a5LcJNcbo6dnobEW5dmTsgo

To claim this, I am signing this object: