Skip to content

Instantly share code, notes, and snippets.

type Query {
article(id: ID!): Article
page(id: ID!): Page
product(id: ID!): Product
profile(id: ID!): Profile
}
type Article {
# Unique identifier for this piece of content */
id: ID!
@bryanjswift
bryanjswift / Vagrantfile
Last active February 25, 2016 02:26 — forked from helloIAmPau/Vagrantfile
A file to install redis server onto an Ubuntu virtual machine.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
package com.android.workaround;
import android.app.Activity;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
/**
* When an {@link Activity} is launched with
@bryanjswift
bryanjswift / vimeo.class.php
Created September 23, 2012 06:52
Perch2 field type for vimeo embeds. Heavily based on youtube.class.php by Drew McLellan.
<?php
/**
* A field type for Vimeo videos
*
* @package default
* @author Bryan Swift
*/
class PerchFieldType_vimeo extends PerchAPI_FieldType
{
@bryanjswift
bryanjswift / twitter-entities.js
Created August 19, 2012 02:31 — forked from wadey/twitter-entities.js
JavaScript parser for Tweet Entities
/*
* twitter-entities.js
* This function converts a tweet with "entity" metadata
* from plain text to linkified HTML.
*
* See the documentation here: http://dev.twitter.com/pages/tweet_entities
* Basically, add ?include_entities=true to your timeline call
*
* Copyright 2010, Wade Simmons
* Licensed under the MIT license
@bryanjswift
bryanjswift / build.sbt
Created March 8, 2012 15:37
Project files for debugging
organization := "com.momentumww"
name := "sxsw-12"
version := "0.0.5"
scalaVersion := "2.9.1"
resolvers ++= Seq(
"Bryan's Repo" at "http://repos.bryanjswift.com/maven2/"
@bryanjswift
bryanjswift / inClassLoader.scala
Created January 19, 2012 03:56
Work around CaseClassSigParser exceptions in sbt:console

When doing something in an SBT console which requires the loading of Case Class instances via fig or jerkson if the code is executed within inClassLoader it will produce a result rather than a ClassNotFoundException.

For example in Persnicketly:

val articles = inClassLoader(classOf[com.persnicketly.persistence.Connection$]) {
  ScoredArticleDao.select(from = 60, count = 100)
}

Will successfully load MongoDB configuration from config.json, access the db and retrieve articles.

@bryanjswift
bryanjswift / Servlet.scala
Created June 11, 2011 04:51
Basic Servlet trait and helper objects to make HttpServletRequest and HttpServletResponse interactions easier
package com.example
import javax.servlet.http.{Cookie, HttpServlet, HttpServletRequest => Request, HttpServletResponse => Response}
import scala.util.matching.Regex
trait Servlet extends HttpServlet {
override def doGet(request:Request, response:Response) = doGet(new HttpHelper(request, response))
override def doPost(request:Request, response:Response) = doPost(new HttpHelper(request, response))
def doGet(http:HttpHelper) { }
def doPost(http:HttpHelper) { }
/* Graph */
#graph { padding: 5px; width: 477px; height: 299px; }
@bryanjswift
bryanjswift / ec2-dns.rb
Created December 2, 2010 04:55
Print out useful information about running ec2 instances
#!/usr/bin/env ruby
#
# This ruby script will print out useful information about running ec2
# instances
#
# Reads AWS access and secret keys from environment variables
#
# Requires the amazon-ec2 gem (gem install amazon-ec2)
#
# Author: Bryan J Swift (bryan.j.swift@gmail.com)