Skip to content

Instantly share code, notes, and snippets.

View jrobber's full-sized avatar
💭
Working in private repos

Jeremy Robertson jrobber

💭
Working in private repos
View GitHub Profile
@jrobber
jrobber / apollo.default.js
Last active February 6, 2021 12:37
sample apollo setup
//Apollo client config to set up the token based on the token in the store. Has to be done this way because apollo uses middleware.
import { ApolloLink } from "apollo-link";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
export default ctx => {
// console.log('apollo init', ctx)
const uri = process.server ? "http://localhost:5000/graphql" : "/graphql";
const httpLink = new HttpLink({ uri });
function doStuff(p1, p2, p3){
var abc = 123;
function yes(a){
console.log('words')
}
return yes;
}
doStuff(2,4,5)(6)
@jrobber
jrobber / 0_reuse_code.js
Created February 28, 2016 06:32
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jrobber
jrobber / birdModel.js
Created November 18, 2015 18:50
basic mongoose examples
var mongoose = require('mongoose');
var birdModel = mongoose.Schema({
scientificName: {type: String, required:true, unique:true, lowercase:true},
color: {type: String, required:true, unique:true},
region: String,
firstSightingEver: Date,
food: [String],
foodDetails: [{
name: String,
angular.module('httpApp').controller('myCtrl', function($scope, myService){
$scope.test = "Working"
$scope.isLoading = true;
var promise = myService.getStarship();
promise.then(myService.getPilots)
.then(function(starshipWithPilots){
$scope.starship = starshipWithPilots;
};
@jrobber
jrobber / code.js
Created October 23, 2015 17:30
Basic Ajax example
$(document).ready(function(){
//var = selector getting the app
var app = $('#ajax-app');
//var = template that is a header that says 'jquery Ajax!
var header = $('<h1>jQuery Ajax!</h1>');
//var = template that is a button that says get Data
var getButton = $('<button>Get Data</button>');
//var = template that is a button that says clear
var clearButton = $('<button>Clear Data</button>');
//var = template for a list (ul)
@jrobber
jrobber / gist:d5437cb4e8b04809c81c
Created October 21, 2015 21:55
Counting Cover Bands
var coverBands = [
{
contact: "[email protected]",
name: "Queen"
},
{
contact: "[email protected]",
name: "Journey"
},
{
@jrobber
jrobber / .gitignore
Created October 13, 2015 18:44
facebook passport example
config.js
@jrobber
jrobber / javascript-review.js
Created September 1, 2015 20:59
Javascript Objects and Arrays review
/*Data / Information
- Make
- Change
- Move
- ?*/
var myClothes = {shirt: "red"};
function IDoStuff(){