Skip to content

Instantly share code, notes, and snippets.

View xuorig's full-sized avatar

Marc-Andre Giroux xuorig

View GitHub Profile
@xuorig
xuorig / gist:8395406
Created January 13, 2014 06:05
sup son
lass AbgtScraper(Scraper):
def __init__(self):
self.index_url = app.config['ABGT_INDEX_URL']
def get_episode_urls(self):
""" Get every episode url so we can scrape them """
try:
page = urlopen(self.index_url)
except:
return []
def longest(s, m):
longest_length = 0
current_length = 0
used_letters = set()
for i, letter in enumerate(s):
if letter not in used_letters:
used_letters.add(letter)
if len(used_letters) > m:
if current_length > longest_length:
longest_length = current_length
Lateral Cut Groove - Spring Tide (Subandrio Remix)
#!/usr/bin/env babel-node --optional es7.asyncFunctions
import fs from 'fs';
import path from 'path';
import { introspectionQuery, printSchema } from 'graphql/utilities';
var fetch = require('node-fetch');
// Save JSON of full schema introspection for Babel Relay Plugin to use
fetch('http://localhost:3000/queries', {
module Mutations
class MarkPullRequestAsReviewed < Graph::Relay::Mutation
class Resolver
class << self
def call(obj, args, ctx)
pr = PullRequest.find(args["pullRequestId"])
pr.update!(reviewed: true)
{ pullRequest: pr }
end
end
// PROTOTYPAL INHERITANCE
// In prototypal languages you only have objects. No classes!
// ex nihilo
const object = Object.create(null);
console.log(object);
// Sample ActionCable ES6 client
//
// To be used like:
//
// const myEventHandlerFunction = (event) => {
// console.log(event.message);
// }
//
// ActionCableClient.connect(
// 'ws://localhost:3000/cable',
@xuorig
xuorig / Puma.md
Last active August 15, 2016 01:41

puma/lib/rack/handler/puma.rb

  • Defines the handler (takes App and conf as args)
  • Sets up a new laucher with conf and events

puma/lib/puma/launcher.rb

  • Runs #run, starts the server

puma/lib/puma/single.rb < puma/lib/puma/runner.rb

  • Runs #run on the "runner"
  • Loads the App @launcher.config.app
@xuorig
xuorig / RPMNewRelic.markdown
Created October 7, 2016 18:18
RPM New Relic

NewRelic's RPM

Main classes/modules

  • NewRelic::Agent
  • NewRelic::Agent::Agent
  • NewRelic::Agent::EventListener
  • NewRelic::Agent::Harvester
  • NewRelic::Agent::EventLoop
  • NewRelic::Agent::Threading::AgentThread
query {
firstFilm: film(id: "1") {
title
}
secondFilm: film(id: "2") {
title
}
}