Skip to content

Instantly share code, notes, and snippets.

View bruno-c's full-sized avatar

Bruno Carriere bruno-c

View GitHub Profile
@bruno-c
bruno-c / index.js
Created December 20, 2019 16:36
Super simple "in-memory" example with Apollo GraphQL from presentation
const { ApolloServer, gql } = require('apollo-server');
const find = require('lodash/find');
const filter = require('lodash/filter');
const map = require('lodash/map');
const { Console } = require('console');
// Our type definitions
const typeDefs = gql`
"""
How the cookie tastes
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@bruno-c
bruno-c / qshash
Last active December 11, 2015 16:29
Query string as hash.
function qshash(){
return location.search.replace('?', '').split("&")
.reduce(function(h, kv){ var v = kv.split('='); h[v[0]] = v[1]; return h; }, {});
}
@bruno-c
bruno-c / jquery.putjson.js
Created August 15, 2011 16:13
jQuery.putJSON - Y U NO LIKE PUT REQUESTS
jQuery.extend({
putJSON: function( url, data, callback ){
return $.ajax({
type: 'put',
url: url,
processData: false,
data: data,
success: callback,
contentType: 'application/json',
dataType: 'json'
@bruno-c
bruno-c / talker-jiranumber.js
Created June 1, 2011 19:18
jira issue linker plugin for Talker
plugin.onMessageInsertion = function(talkerEvent){
// Change those values with yours.
// When you type JIRA-1234, it will automatically convert it to a link
var jiraServer = 'https://xxx.xxx.com'
, browseLink = '<a href="' + jiraServer + '/browse/$1" target="_blank">$1</a>'
, jiraPrefix = 'AE-'
, jiraRegex = new RegExp('('+jiraPrefix+'\\d+\\b)', 'gi');
@bruno-c
bruno-c / f7u12talker.js
Created June 1, 2011 13:59
f7u12 faces plugin for talker
/* Written by @vincentsimard */
/*
Converts f7u12 faces code into images
See http://www.reddit.com/r/fffffffuuuuuuuuuuuu/comments/ecnd4/every_fffffffuuuuuuuuuuu_face_a_reference_guide for reference
Does not support titles, or any other cool features
Type [/code] to use the face in Talker.
*/
plugin.F7U12Faces = function(matcher){
this.matcher = matcher;
@bruno-c
bruno-c / LICENSE.txt
Created May 27, 2011 20:20 — forked from 140bytes/LICENSE.txt
functor collection: works with coll(k) to get, coll.add(k, v) to add, coll.del(k) to remove
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Bruno Carriere <http://js-montreal.org>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bruno-c
bruno-c / jquery.subquery.js
Created May 24, 2011 16:48
jQuery plugin that creates a 'subquery' object - basically lets you work with a specific chunk of elements or with detached elements in a way that's less annoying.
jQuery.fn.subquery = function(){
var ctx = $(this);
return function(){
return arguments.length ? ctx.find.apply(ctx, arguments) : ctx;
};
};
// Given something like:
// <article id="article1">
// <h3>foobar</h3>