Skip to content

Instantly share code, notes, and snippets.

View itkrt2y's full-sized avatar
Yak Shaving

Tatsuya Itakura itkrt2y

Yak Shaving
View GitHub Profile
rmosolgo / page_example.rb
Created April 10, 2019 14:07
Generic page number / per-page pagination with GraphQL-Ruby
# This is a full-blown offset-based pagination system modelled after GraphQL-Ruby's
# built-in connections. It has a few different elements:
# - `::Page`, a plain ol' Ruby class for modeling _pages_ of things.
# This class handles applying pagination arguments to lists (Arrays and AR::Relations)
# and provides metadata about pagination. (Similar to `will_paginate`.)
# - `Schema::BasePage` is a generic GraphQL-Ruby object type. It's never used directly,
# but it can generate subclasses which wrap _specific_ object types in the schema.
# - `Schema::BaseObject.page_type` is a convenience method for generating page types
# from your object types. You could leave this out and make subclasses with plain ol'
rviscomi /
Last active May 7, 2019 10:52
"Crash Course in CrUX" for the PerfMatters conference, April 2019
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
default: &default
adapter: mysql2
encoding: utf8mb4
username: root
host: localhost
voluntas / new_to_mqtt.rst
Last active October 2, 2023 06:26
初めての MQTT