This file contains hidden or 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
| [ | |
| { | |
| "context": "Editor", | |
| "bindings": { | |
| "alt-up": "editor::SelectLargerSyntaxNode", | |
| "alt-down": "editor::SelectSmallerSyntaxNode", | |
| "ctrl-cmd-up": "editor::MoveLineUp", | |
| "ctrl-cmd-down": "editor::MoveLineDown" | |
| } | |
| } |
This file contains hidden or 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
| https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/ | |
| // Parse the URL | |
| function getParameterByName(name) { | |
| name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
| var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); | |
| var results = regex.exec(location.search); | |
| return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
| } |
This file contains hidden or 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 { Controller } from 'stimulus'; | |
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import AppContainer from 'components/core/AppContainer'; | |
| export default class extends Controller { | |
| connect() { | |
| const Component = window.ReactComponents[this.data.get('component')]; | |
| let props = this.data.get('props') || {}; | |
| if (typeof props === 'string') { |
This file contains hidden or 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
| require 'optparse' | |
| require 'json' | |
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'redis' | |
| gem 'oj' | |
| end |
This file contains hidden or 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
| ruby '2.7.1' | |
| gem 'rails', github: 'rails/rails' | |
| gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
| # Action Text | |
| gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
| gem 'okra', github: 'basecamp/okra' | |
| # Drivers |
- Website: https://stimulusjs.org/
- GitHub repo: https://github.com/stimulusjs/stimulus
- Handbook: https://stimulusjs.org/handbook/introduction
- Discourse: https://discourse.stimulusjs.org/
initialize: once, when the controller is first instantiatedconnect: anytime the controller is connected to the DOM
This file contains hidden or 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
| todos_reducer = -> (state, action) { | |
| state ||= [] | |
| case action[:type] | |
| when 'add' | |
| state.push(action[:todo]) | |
| when 'remove' | |
| state.remove(action[:todo]) | |
| else | |
| state |
This file contains hidden or 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
| class ReduxStore | |
| def self.combine_reducers(reducers) | |
| -> (state, action) { | |
| state ||= {} | |
| reducers.reduce({}) { |next_state, (key, reducer)| | |
| next_state[key] = reducer.call(state[key], action) | |
| next_state | |
| } | |
| } |
This file contains hidden or 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
| class ReduxStore | |
| attr_reader :current_state | |
| def initialize(reducer) | |
| @reducer = reducer | |
| @listeners = [] | |
| @current_state = nil | |
| dispatch({}) | |
| end |
NewerOlder