Skip to content

Instantly share code, notes, and snippets.

View Kielan's full-sized avatar
💻
Java Rust Go Swift C# Typescript React Graphql C C++ Python

Kielan Kielan

💻
Java Rust Go Swift C# Typescript React Graphql C C++ Python
View GitHub Profile
@Kielan
Kielan / hashString
Created February 15, 2015 17:05
top secret lulz
var hashString = "leepadg";
function hash(string) {
var h = 7;
var letters = "acdegilmnoprstuw";
for(i=0; i< string.length; i++) {
h = (h*37+ letters.indexOf(string[i]));
}
console.log(h);
}
@Kielan
Kielan / seeds.js
Last active August 29, 2015 14:19
var fs = require('fs')
, fw = require('./node_modules/jesus/fw.js')
, mongoose = require('mongoose')
, mongodb = require('mongodb')
, colors = require('colors')
, path = require('path');
function iterateDataFiles(passedIn) {
return process.stdout;
//more complete chat IMO
package main
import (
"bufio"
"fmt"
"log"
"net"
)
@Kielan
Kielan / checkboxes.js
Created September 5, 2016 11:22
3 components depicting a grid layout in react
/*
I want to pass the index of each checbox down through checkboxrow to properly alternate
background color from light gray and gray
*/
function Checkboxes({data, size, spacing, className}) {
let boxSpacing = cx({
bigWideSpacing : spacing === 'wide' && size === 'big',
bigNarrowSpacing : spacing === 'narrow' && size === 'big',
smallWideSpacing : spacing === 'wide' && size === 'small',
smallNarrowSpacing : spacing === 'narrow' && size === 'small'
@Kielan
Kielan / destructuring.js
Created June 9, 2017 11:04 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
export default function initAuth() {
let stores = [
Store1.loadFromStore,
Store2.loadFromStore,
Store3.loadFromStore,
];
return stores.map((store) => {
let notEncryptedStore = store();
})
@Kielan
Kielan / instructions.md
Created April 6, 2019 20:41 — forked from nikolasburk/instructions.md
Use the Contentful GraphQL API inside a GraphQL Playground

Use the Contentful GraphQL API inside a GraphQL Playground

The Contentful GraphQL API ships with GraphiQL by default. To get even better workflows (such as multiple tabs, speciyfing HTTP headers or work with multiple GraphQL APIs side-by-side), you can use a GraphQL Playground.

1. Get the endpoint for your Contentful GraphQL API

The endpoint of your Contentful GraphQL API has the following structure: https://cdn.contentful.com/spaces/{SPACE}/graphql/alpha/explore?access_token={CDA_TOKEN}

There are two placeholders that need to be replaced:

@Kielan
Kielan / infoLog
Created April 16, 2019 16:56
info log of resolver
info: { fieldName: 'title',
fieldNodes:
[ { kind: 'Field',
alias: undefined,
name: [Object],
arguments: [],
directives: [],
selectionSet: undefined,
loc: [Object] } ],
returnType: String!,