Skip to content

Instantly share code, notes, and snippets.

@bradley-curran
bradley-curran / makeExecutableSchema.js
Created February 18, 2022 00:16
makeExecutableSchema without graphql-tools
const { buildSchema } = require('graphql');
const express = require('express');
const { graphqlHTTP } = require('express-graphql');
const makeExecutableSchema = (schema, resolverMap) => {
const executableSchema = buildSchema(schema);
Object.keys(resolverMap).forEach(typeKey => {
const fields = executableSchema.getType(typeKey).getFields();
Object.keys(resolverMap[typeKey]).forEach(fieldKey => {
@bradley-curran
bradley-curran / VelocAdapter.java
Created August 5, 2013 05:09
This is my first iteration of the adapter style I'd like to use. There's only one method that needs to be implemented - bindView().
package com.bradleycurran.droidquery.adapter;
import java.util.List;
import android.content.Context;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
@bradley-curran
bradley-curran / NetworkHelper.cpp
Created November 7, 2012 05:29
A helper class to download files in Blackberry 10. For more information visit cascadeswithlove.com
#include "NetworkHelper.h"
#include <QDebug>
#include <QUrl>
#include <QNetworkRequest>
#include <QNetworkReply>
NetworkHelper::NetworkHelper(QObject* parent, const QString& url) :
QObject(parent),
@bradley-curran
bradley-curran / JsonHelper.cpp
Created November 7, 2012 05:17
Classes to help with parsing JSON data in Blackberry 10. For more information visit cascadeswithlove.com
#include "JsonHelper.h"
#include <bb/data/JsonDataAccess>
using namespace bb::data;
JsonHelper::JsonHelper()
{
}
@bradley-curran
bradley-curran / Ram.java
Created March 22, 2014 09:43
How to ram the contents of an adapter into a linear layout
// Needless to say, don't use this with an adapter with a lot of items.
// Use a list view instead
public static void ram(ViewGroup parent, BaseAdapter adapter) {
for (int i = 0; i < adapter.getCount(); i++) {
View view = adapter.getView(i, null, parent);
parent.addView(view);
}
}