Community
Cheatsheets
- GenServer Cheatsheet by Benjamin Tan Wei Hao
Books
| async function nextFrame() { | |
| return new Promise((resolve) => { | |
| requestAnimationFrame(resolve) | |
| }) | |
| } | |
| async function randomDelay(min, max) { | |
| const delay = Math.random() * (max - min) + min; | |
| const startTime = performance.now() | |
| while (performance.now() - startTime < delay) { |
| defmodule Ecto.Polymorphic do | |
| defmacro __using__(_) do | |
| quote do | |
| require Ecto.Schema | |
| import Ecto.Schema, except: [belongs_to: 2, belongs_to: 3] | |
| import unquote(__MODULE__) | |
| end | |
| end |
| /* globals localStorage */ | |
| import { onSnapshot, applySnapshot } from 'mobx-state-tree'; | |
| import Storage from './storage'; | |
| export const persist = (name, store, options, schema = {}) => { | |
| let hydrated = false; | |
| let storage = options.storage; | |
| if (typeof localStorage !== 'undefined' && localStorage === storage) { |
| defmodule MyApp.Auth do | |
| @moduledoc """ | |
| Creates `Ueberauth.Auth` structs from OAuth responses. | |
| This module is an ugly hack which is necessary because `Ueberauth` doesn't provide | |
| the necessary hooks to get such a struct without giving it control of the whole | |
| callback phase. We can't do this in the API because all the mobile app can give us | |
| is the OAuth token. | |
| Most of the code was lifted from Ueberauth, with minor changes as needed. |
Community
Cheatsheets
Books
| defmodule Absinthe.Ecto.Resolution.Schema do | |
| @moduledoc """ | |
| This module provides helper functions to resolve a GraphQL query into `Ecto.Query`. | |
| """ | |
| import Absinthe.Resolution.Helpers | |
| import Ecto.Query | |
| alias Absinthe.Resolution | |
| alias Absinthe.Blueprint.Document.Field | |
| :root { | |
| --ease-in-quad: cubic-bezier(.55, .085, .68, .53); | |
| --ease-in-cubic: cubic-bezier(.550, .055, .675, .19); | |
| --ease-in-quart: cubic-bezier(.895, .03, .685, .22); | |
| --ease-in-quint: cubic-bezier(.755, .05, .855, .06); | |
| --ease-in-expo: cubic-bezier(.95, .05, .795, .035); | |
| --ease-in-circ: cubic-bezier(.6, .04, .98, .335); | |
| --ease-out-quad: cubic-bezier(.25, .46, .45, .94); | |
| --ease-out-cubic: cubic-bezier(.215, .61, .355, 1); |
Hello, Ben.
It was good to meet you in the Ask The Experts Booth at this year's DockerCon. Thank you for answering my questions about LDAP integration with the DataCenter's role-based access control, and for patiently attempting to explain to me how we at Medidata, the "docker-compose uninitiated", might overcome our need to bundle Ruby gems from non-public Git repositories, using only docker-compose. I'm still unclear on the specifics of the technique you laid out, so thanks even more for offering to provide an example!
Fortunately, our problem is very simply expressed as a single line added to the excellent [Rails example][1] that you guys already posted for Docker compose. Only the build phase is relevant here, so our problem can be quickly reproduced by following those instructions faithfully, until the part where it says to add the rubyracer gem to the Gemfile.
At that point, if we also add a gem whose source is a non-public git repo, of the form:
gem 'mygem', :git => 'git@github.com:user/myg
| javascript:(function(){(function printStats(){var loadTimes=window.chrome.loadTimes();firstPaint=loadTimes.firstPaintTime*1000;firstPaintTime=firstPaint-(loadTimes.startLoadTime*1000);console.info('First paint took',firstPaintTime,'ms');console.info('Load took',performance.timing.loadEventStart-performance.timing.navigationStart,'ms');var instances=0;if(parseFloat(Polymer.version)<1){instances=[].slice.call(document.querySelectorAll('html /deep/ *')).filter(function(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}).length;}else{instances=Polymer.telemetry.instanceCount;}console.info('Custom element instances:',instances);var reflectCount=0;if(Polymer.telemetry){console.info('=== Properties set to reflectToAttribute ===');Polymer.telemetry.registrations.forEach(function(el){for(var prop in el.properties){if(el.properties[prop].reflectToAttribute){console.log(el.is+'.'+prop);reflectCount++;}}});}else{console.info('=== Properties set to reflect ===');Polymer.elements.forEach(function(el){for(var |
| { | |
| "env": { | |
| "browser": true, | |
| "node": true, | |
| "es6": true | |
| }, | |
| "plugins": ["react"], | |
| "ecmaFeatures": { |