Skip to content

Instantly share code, notes, and snippets.

View remy's full-sized avatar
🌮
Be more taco

Remy Sharp remy

🌮
Be more taco
View GitHub Profile
@southpolesteve
southpolesteve / thoughts.md
Last active March 19, 2021 23:42
Random GraphQL+RDBMS+AWS Lambda Thoughts
  • GraphQL is awesome. I was not a fan at first, but I have since been converted. I wouldn't hesitate to use it for anything new. Its not perfect though.
  • Running on Lambda is pretty straight forward. We have our own custom code for that, but if I was starting fresh, I would use the Apollo GraphQL server. They have one that is designed to run on Lambda. I've played with it and it works well.
  • If your graphQL resolvers are talking directly to a DB, make sure to share connections between requests. One connection per lambda instance. If you spin up a new connection per request you will have a bad time. I guess this is generally true for not-graphql lambda things too.
  • You need dataloader. It will batch DB queries for you. It (or something like it) is pretty critical to making any graphQL setup performant. Or at least not overload your DB.
  • You proabably need to follow the Relay spec. We didn't d
@southpolesteve
southpolesteve / auth.js
Last active February 6, 2018 21:57
graphQL schema auth
// Search every field and swap out the resolvers if an `authorize` key is present
export function authorize (schema) {
// We require auth for all mutations
const mutations = (schema._mutationType && Object.keys(schema._mutationType._fields)) || []
mutations.forEach(mutationName => {
const field = schema._mutationType._fields[mutationName]
invariant(field.authorize, `Mutation: "${mutationName}" must have an "authorize" property. Use "*" for no auth`)
})
@ismyrnow
ismyrnow / mac-clear-icon-cache.sh
Created May 5, 2017 19:28
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
@remy
remy / _README.md
Last active April 21, 2017 16:00
Quick and dirty mongoose crud interface.

Example usage

const express = require('express');
const List = require('../models/list');
const Crud = require('./crud');

const list = new Crud(List, { queryKey: 'publicId' });
const router = express.Router();
module.exports = router;
@csswizardry
csswizardry / README.md
Last active June 16, 2024 13:44
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
const ToggleDisplayMatch = ({ component: Component, ...rest }) => (
<Match {...rest}>
{({ matched, ...props }) => (
<div style={{ display: matched ? 'block' : 'none' }}>
<Component {...props}/>
</div>
)}
</Match>
)
@konradko
konradko / golang_on_rpi.md
Last active September 24, 2024 14:37
Install Golang 1.7 on Raspberry Pi
wget https://storage.googleapis.com/golang/go1.7.linux-armv6l.tar.gz
tar -C /usr/local -xzf go1.7.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin
@bendc
bendc / immutable.js
Created January 6, 2016 16:56
Deep freeze objects
const immutable = (() => {
const getValue = obj => key => obj[key];
const isObject = obj => Object(obj) === obj;
const isMutable = obj => isObject(obj) && !Object.isFrozen(obj);
return obj => {
Object.keys(obj).map(getValue(obj)).filter(isMutable).forEach(immutable);
return Object.freeze(obj);
};
})();

32C3 CTF 2015 : Sequence Hunt

Category: Web Points: 200 Solves: 19 Description:

May we interest you in a little programming exercise?

@cem2ran
cem2ran / main.js
Created December 28, 2015 01:10
React Getting Started - How it should be!
import React from 'react'
import ReactDOM from 'react-dom'
const Hello = ({name}) => <h1>Hello {name}!</h1>
ReactDOM.render(
<Hello name={"vjeux"}/>,
document.body.appendChild(document.createElement("div"))
)