Skip to content

Instantly share code, notes, and snippets.

View jwo's full-sized avatar

Jesse Wolgamott jwo

View GitHub Profile
@jwo
jwo / query.graphql
Last active November 26, 2020 15:11
GraphQL Example for GitHub API repo statuses on a pull request. We know before hand that it's "jwo/react-hover-image" and pull request number 4
{
repository(owner: "jwo", name:"react-hover-image"){
url
pullRequest(number: 4){
number
url
author {
avatarUrl
login
resourcePath
@jwo
jwo / action.html.erb
Last active April 19, 2020 21:31
register React component on page with turbolinks working. The Rails parts (helper and ERB) are optional, but since this IS turbolinks, you probably ARE using rails.
<h1>Oh Hai</h1>
<%= react_component 'oh-hai' %>
@jwo
jwo / gist:2585904
Created May 3, 2012 14:11 — forked from unnitallman/gist:944011
sqlite with activerecord outside rails
require 'active_record'
require 'logger'
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.establish_connection(
adapter: "sqlite3",
database: ":memory:"
)
# And, to activate, you need to tell Rails to load it up:
# config/application.rb
config.middleware.insert_before 0, Rack::Attack
@jwo
jwo / index.html
Created June 20, 2016 19:27
http://locationiq.org seems pretty great for Geocoding and reverse geo-coding. * And it works in standard jquery across domains, so it’ won’t trip up people with CORS. * Can work in simple server side queries as well for the same reason * Reverse geocoding works too though not as a replacement for foursquare places. Good for city/state tho. * It…
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@jwo
jwo / Dockerfile
Created October 26, 2017 20:52
Node app which uses dockerode to run a simple test suite against a Git Repo.
FROM node:8
RUN npm install -g write-good
ADD clone-run.sh /tmp/clone-run.sh
@jwo
jwo / app.js
Created July 10, 2017 14:40
Simple example for testing an HTML endpoint in node with supertest and chai. Most examples only test API endpoints it seems.
const express = require("express");
const mustache = require("mustache-express");
const bodyParser = require("body-parser");
const app = express();
// Rest of the stuff here
// DONT FORGET THIS
module.exports = app;
@jwo
jwo / game.js
Created July 6, 2017 16:21
sample schema for mongoose
const mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
mongoose.connect('mongodb://localhost:27017/eighties');
const gameSchema = new mongoose.Schema({
name: {type: String, required: true},
imageUrl: {type: String, required: true},
tags: [String],
year: {type: Number, required: true},
link: {type: String, required: true}
@jwo
jwo / spoon.js
Created June 7, 2017 16:15
Such a great super great awesome example of nested for loops
function properCase(sentence){
const words = sentence.split(' ');
let newWords = []
// Start the big spoon
for(let i = 0; i < words.length; i++){
const word = words[i];
@jwo
jwo / create_project.sh
Created May 22, 2017 19:12
Sample Shell script
#!/bin/bash
echo 'So you want to create a new project, eh?'
echo 'What is the name of the project?'
read project_name
mkdir $project_name