(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # Copyright Musab Kilic 2018 | |
| # Special thanks to Noam Nisan and Shimon Schocken | |
| # Course page: https://www.coursera.org/learn/build-a-computer/ | |
| # | |
| # Usage: python submit.py [folder(0-6)/full] | |
| # Example: python submit.py 0 | |
| # python submit.py full | |
| from __future__ import division | |
| import os |
| # On slow systems, checking the cached .zcompdump file to see if it must be | |
| # regenerated adds a noticable delay to zsh startup. This little hack restricts | |
| # it to once a day. It should be pasted into your own completion file. | |
| # | |
| # The globbing is a little complicated here: | |
| # - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct. | |
| # - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error) | |
| # - '.' matches "regular files" | |
| # - 'mh+24' matches files (or directories or whatever) that are older than 24 hours. | |
| autoload -Uz compinit |
| var elements = Array.from(document.querySelectorAll('.js-link-block')) | |
| elements.map(function (element) { | |
| var nameElement = element.querySelector('.chartlist-name') | |
| return nameElement && nameElement.textContent.replace(/\s+/g, ' ').trim() | |
| }).forEach(function (name, i, names) { | |
| if (name !== names[i + 1]) return | |
| var deleteButton = elements[i].querySelector('[data-ajax-form-sets-state="deleted"]') | |
| if (deleteButton) deleteButton.click() | |
| location.reload() | |
| }) |
This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.
It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.
| require 'rbnacl' | |
| require 'base64' | |
| class Example | |
| attr_reader :secret_box, :index_key | |
| def initialize | |
| key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes) | |
| @index_key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes) | |
| @secret_box = RbNaCl::SecretBox.new(key) |
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| // the interface | |
| var utils = { | |
| addListener: null, | |
| removeListener: null | |
| }; | |
| // the implementation | |
| if (typeof window.addEventListener === 'function') { | |
| utils.addListener = function (el, type, fn) { | |
| el.addEventListener(type, fn, false); |
| Warden::Manager.serialize_into_session{|user| user.id } | |
| Warden::Manager.serialize_from_session{|id| User.get(id) } | |
| Warden::Manager.before_failure do |env,opts| | |
| # Sinatra is very sensitive to the request method | |
| # since authentication could fail on any type of method, we need | |
| # to set it for the failure app so it is routed to the correct block | |
| env['REQUEST_METHOD'] = "POST" | |
| end | |