Skip to content

Instantly share code, notes, and snippets.

View brysgo's full-sized avatar

Bryan Goldstein brysgo

View GitHub Profile
@brysgo
brysgo / mongoose-authorization
Created May 17, 2018 16:59
Add support for promises and fix sub-object bug
const _ = require("lodash");
function resolveAuthLevel(schema, options, doc) {
// Look into options the options and try to find authLevels. Always prefer to take
// authLevels from the direct authLevel option as opposed to the computed
// ones from getAuthLevel in the schema object.
let authLevelsIn = [];
if (options) {
if (options.authLevel) {
authLevelsIn = options.authLevel;
@brysgo
brysgo / .useralias
Last active April 27, 2018 19:53
Use alias for home directory (if username has a space)
myshortname
@brysgo
brysgo / cloudSettings
Last active July 25, 2020 01:32
vscode user settings
{"lastUpload":"2020-07-25T01:32:22.204Z","extensionVersion":"v3.4.3"}
@brysgo
brysgo / graphiql-bookmarklet.es6
Last active October 11, 2016 16:36
GraphiQL Bookmarklet
document.removeChild(document.documentElement);
var html = document.createElement('html');
var head = document.createElement('head')
html.appendChild(head);
var body = document.createElement('body');
var reactRoot = body.appendChild(document.createElement('div'));
html.appendChild(body);
document.appendChild(html);
@brysgo
brysgo / gist:e414fb63752f07736aa0
Last active October 15, 2015 19:43
_bitriseCustomScript.sh
#!/bin/bash
npm install react-native
echo "."
@brysgo
brysgo / Texture.js
Last active January 10, 2019 11:58
React native repeating texture component
var React = require('react-native');
var {
Image,
View,
} = React;
var Texture = React.createClass({
_onLayout: function(event) {
let tileWidth = this.props.width;
let tileHeight = this.props.height;
@brysgo
brysgo / graffitiMongoose.js
Created July 31, 2015 16:31
Hack to add subdocuments to graffiti schema.
import {getTypes} from '@risingstack/graffiti-mongoose';
import Models, { User } from '../mongoose';
import Subdocuments from './subdocuments';
let types = getTypes(Models)
let UserType = types.User;
// FIXME: Hack subdocument for now
Object.assign(UserType._typeConfig.fields, {
bestFriend: Subdocuments.singular(User, UserType),
#import "AppDelegate.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary *env = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"environment" ofType:@"plist"]];
NSString *serverURLString = [NSString stringWithFormat:@"http://%@/index.ios.bundle", [env objectForKey:@"hostname"]];
NSURL *codeURL = [NSURL URLWithString:serverURLString];
@brysgo
brysgo / Advert.js
Created July 26, 2015 02:40
Example of using Relay inspired framework `react-transmit` with temporary client side state.
// src/views/Advert.js
import __fetch from "isomorphic-fetch";
import React from "react";
import Transmit from "react-transmit";
import AdvertStore from "stores/AdvertStore";
import _ from "utils/Utils";
class Advert extends React.Component {
render () {
return (
@brysgo
brysgo / Wavy Loading Animations.markdown
Created July 10, 2015 16:08
Wavy Loading Animations