Skip to content

Instantly share code, notes, and snippets.

Tanguy Antoine tanguyantoine

Block or report user

Report or block tanguyantoine

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View style.css
html {
font-family: 'Source Sans Pro',sans-serif;
}
@tanguyantoine
tanguyantoine / EventEmitter.ts
Created Jul 11, 2019
Event emitter Typescript/ES6
View EventEmitter.ts
export class EventEmitter {
private readonly events: Record<string, Function[]> = {}
on = (event: string, listener: Function) => {
if (typeof this.events[event] !== 'object') {
this.events[event] = []
}
this.events[event].push(listener)
}
View keybase.md

Keybase proof

I hereby claim:

  • I am tanguyantoine on github.
  • I am tanguyantoine (https://keybase.io/tanguyantoine) on keybase.
  • I have a public key ASD50cSsodImw9P3SEPTE5nuzLbAHxW9CO5tHfePkBj5mgo

To claim this, I am signing this object:

@tanguyantoine
tanguyantoine / foo_type.rb
Created Aug 19, 2017
New Relic GraphQL Ruby instrumentation
View foo_type.rb
Types::FoosType = GraphQL::ObjectType.define do
field :foos, !types[Types::FooType] do
timed true # enable New Relic trace_execution_scoped
description "Returns foos"
argument :per, types.Int, default_value: 20
argument :page, types.Int, default_value: 1
# Moving to cursor pagination would be better
resolve(...)
end
end
@tanguyantoine
tanguyantoine / newrelic_instrumenter.rb
Created Aug 19, 2017 — forked from nettofarah/newrelic_instrumenter.rb
sample newrelic instrumenter for graphql-ruby
View newrelic_instrumenter.rb
# NewRelic instrumenter for GraphQL-ruby
#
# In your controller:
# ::NewRelic::Agent.add_custom_attributes({
# user_id: @user.try(:id),
# query_string: @query_string,
# query_arguments: @query_variables
# })
#
# @document = self.class.trace_execution_scoped(["GraphQL#parse"]) do
View enzyme-test.js
import {expect} from 'chai';
import App from '../app/components/App';
import a11yHelper from "./a11yHelper";
describe('Accessibility', function () {
this.timeout(10000);
it('Has no errors', function () {
let config = {};
@tanguyantoine
tanguyantoine / hammerspoon.lua
Last active Aug 29, 2015
Hammerspoon Config
View hammerspoon.lua
-------- position -----------
--[[
& - "
- - -
è - ç
]]--
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "&", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
@tanguyantoine
tanguyantoine / Gruntfile.coffee
Last active Aug 29, 2015
Livereload rails - grunt
View Gruntfile.coffee
terminal = require('color-terminal')
log = (error, stdout, stderr, cb) ->
if error
terminal.color('red').write stdout
else
terminal.color('green').write stdout
cb()
View es-name-test.sh
#!/bin/sh
# Delete old version to make sure new settings are applied
curl -XDELETE "localhost:9200/names-test/"
echo
# See https://github.com/elasticsearch/elasticsearch-analysis-phonetic
curl -XPUT "localhost:9200/names-test" -d '{
"settings": {
"analysis": {
"analyzer": {
"lowkeyword-analyzer": {
@tanguyantoine
tanguyantoine / update_array_of_integer_with_retire.rb
Created Mar 4, 2014
rails, elasticsearch , tire bulk update array of ids (integers)
View update_array_of_integer_with_retire.rb
class MyModel < ActiveRecord::Base
mapping do
indexes :array_ids, index: :not_analyzed
end
def to_indexed_json
{
array_ids: array_of_integers # [35, 56, 43 ]
}
You can’t perform that action at this time.