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
| export function updateProp(value, path) { | |
| return { | |
| type: 'UPDATE_PROP', | |
| payload: { | |
| path, | |
| value, | |
| } | |
| } | |
| } |
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 { EditorState, Modifier, Entity, SelectionState } from 'draft-js' | |
| import linkifyIt from 'linkify-it' | |
| import tlds from 'tlds' | |
| const linkify = linkifyIt() | |
| linkify.tlds(tlds) | |
| const linkifyEditorState = (editorState) => { | |
| const contentState = editorState.getCurrentContent() |
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 { observable } from 'mobx' | |
| class UIStore { | |
| @observable isSliderOpen = false; | |
| @observable isAccountDropdownOpen = false; | |
| constructor(state) { | |
| Object.assign(this, 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
| const observables = { | |
| count: 1, | |
| computedFunc: () => { | |
| return this.count + 1 | |
| } | |
| } | |
| const actions = { | |
| increment: () => { | |
| this.count += 1 |
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 'erb' | |
| require 'tilt' | |
| paths = Dir.glob('content/**/*').select{ |e| File.file? e } | |
| paths.each do |path| | |
| content = Tilt.new(path) | |
| layout = Tilt.new('layouts/index.erb') | |
| output = layout.render { content.render } |
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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "sort" | |
| "net/http" | |
| "time" | |
| "github.com/radovskyb/watcher" | |
| "github.com/jarsbe/leaf" |
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
| crumbs := func(c *leaf.Compiler) { | |
| c.TemplateFuncs["Breadcrumbs"] = func(d leaf.Document) template.HTML { | |
| var links []string | |
| var link string | |
| var anchor string | |
| crumbs := strings.Split(d.Anchor, string(os.PathSeparator)) | |
| for idx, _ := range crumbs { | |
| if idx == 0 { |
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
| BOX_MAP = [ | |
| [0, 1, 2, 9, 10, 11, 18, 19, 20], | |
| [3, 4, 5, 12, 13, 14, 21, 22, 23], | |
| [6, 7, 8, 15, 16, 17, 24, 25, 26], | |
| [27, 28, 29, 36, 37, 38, 45, 46, 47], | |
| [30, 31, 32, 39, 40, 41, 48, 49, 50], | |
| [33, 34, 35, 42, 43, 44, 51, 52, 53], | |
| [54, 55, 56, 63, 64, 65, 72, 73, 74], |
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
| (def school (reduce (fn [acc g] (assoc acc g { :grade g :students [] })) {} (range 1 8))) | |
| (defn add-student [name grade school] | |
| (assoc-in | |
| school [grade :students] | |
| (vec (sort (conj (:students (get school grade)) name))))) | |
| (defn add-students [school [name grade]] | |
| (add-student name grade school)) |
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 School | |
| attr_accessor :classes | |
| def initialize | |
| @classes = 7.times.map do |i| | |
| { | |
| grade: i + 1, | |
| students: [] | |
| } | |
| end |