A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Modified from https://gist.github.com/NicholasKimuli/2b167ca1c6ce03cb860e3f89d17db1eb | |
Bonaire, Saba and Sint Eustatius may need a future flag update --> | |
<select class="input-block-level" id="countryCode" name="countryCode"> | |
<option data-countryCode="AF" value="93">🇦🇫 Afghanistan (+93)</option> | |
<option data-countryCode="AL" value="355">🇦🇽 Albania (+355)</option> | |
<option data-countryCode="DZ" value="213">🇩🇿 Algeria (+213)</option> | |
<option data-countryCode="AD" value="376">🇦🇩 Andorra (+376)</option> | |
<option data-countryCode="AO" value="244">🇦🇴 Angola (+244)</option> | |
<option data-countryCode="AI" value="1264">🇦🇮 Anguilla (+1264)</option> | |
<option data-countryCode="AG" value="1268">🇦🇬 Antigua & Barbuda (+1268)</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=> | |
// arrays | |
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
// components | |
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=> | |
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):( | |
// create notes | |
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
// diff props |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scaffold your project | |
npx preact-cli@rc create default my-app && cd my-app | |
# upgrade to Preact X | |
npm i -D preact-cli@rc && npm i preact@latest preact-router@latest preact-render-to-string@latest | |
npm rm preact-compat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { shallow } from 'enzyme'; | |
import MyComponent from '../src/my-component'; | |
const wrapper = shallow(<MyComponent/>); | |
describe('(Component) MyComponent', () => { | |
it('renders without exploding', () => { | |
expect(wrapper).to.have.length(1); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns toto.core) | |
(let [button (.getElementById js/document "button") | |
input (.getElementById js/document "input")] | |
(.addEventListener button "click" | |
(fn [event] | |
(.log js/console (nth input/files 0))))) |
This is the example that comes with the reagent template converted to use HTML5 based history. This means there are no #
in the urls.
I just got this working, so there might be better approaches
The changes are
- use
goog.history.Html5history
instead ofgoog.History
- listen to clicks on the page, extract the path from them, and push them onto the history
- listen to history changes, and have secretary do its thing in response
Rich Hickey • 3 years ago
Sorry, I have to disagree with the entire premise here.
A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.
Mastery comes from a combination of at least several of the following:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original Rails controller and action | |
class EmployeesController < ApplicationController | |
def create | |
@employee = Employee.new(employee_params) | |
if @employee.save | |
redirect_to @employee, notice: "Employee #{@employee.name} created" | |
else | |
render :new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Author : Emad Elsaid (https://github.com/blazeeboy) | |
require 'sinatra' | |
set :port, 3000 | |
set :environment, :production | |
get '/' do | |
<<-EOT | |
<html><head> |
NewerOlder