let store = null
const listeners = []
export const getStore = () => store
export const subscribe = fn => {
listeners.push(fn)
+ return () => listeners.filter(l => l !== fn) // return `unsubscribe` function
}
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 code from http://codepen.io/martinwolf/pen/qlFdp */ | |
p | |
font-size 21px | |
line-height 1.2 | |
lines-to-show = 3 | |
display block /* Fallback for non-webkit */ | |
display -webkit-box | |
max-width 400px | |
height @font-size * @line-height * lines-to-show /* Fallback for non-webkit */ |
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
// font-face mixin | |
font-url(file) | |
return 'fonts/' + file | |
webfont(family, file, weight = normal) | |
@font-face | |
font-family family | |
file += '/' + file | |
src url(font-url(file + '.eot')), | |
url(font-url(file + '.woff')) format('woff'), |
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
# npm install gulp-uglify browser-sync gulp-notify browserify vinyl-source-stream gulp-streamify watchify gulp-if colors gulp --save-dev | |
uglify = require 'gulp-uglify' | |
sync = require 'browser-sync' | |
notify = require 'gulp-notify' | |
browserify = require 'browserify' | |
source = require 'vinyl-source-stream' | |
streamify = require 'gulp-streamify' | |
watchify = require 'watchify' | |
gulpif = require 'gulp-if' | |
colors = require 'colors' |
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
/** | |
* Реализация API, не изменяйте ее | |
* @param {string} url | |
* @param {function} callback | |
*/ | |
function getData(url, callback) { | |
var RESPONSES = { | |
'/countries': [ | |
{name: 'Cameroon', continent: 'Africa'}, | |
{name :'Fiji Islands', continent: 'Oceania'}, |
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 life-game) | |
(use '[clojure.string :only (join)]) | |
(def n 30) | |
(def table | |
(->> | |
(range n) | |
(map (fn [x] n)) | |
(map (fn [x] (into [] (map (fn [x] (Math/round (rand))) | |
(range x))))) |
made with esnextbin
made with esnextbin
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 { compact, uniq, take } from 'lodash' | |
const wrap = function (fn, ...args) { | |
return fn(this, ...args) | |
} | |
const exampleData = [ | |
{ date: '03/12/2012', text: '12 марта' }, | |
{ date: '03/13/2012', text: '13 марта' }, |
На русском:
- Изучите X за Y минут, где X = Clojure ⬈ learnxinyminutes.com
- Видеокурс «ClojureScript для JavaScript программистов» ⬈ youtube.com
- Clojure, или «Вы все еще используете Java? Тогда мы идем к вам!» ⬈ fprog.ru
Полезный софт:
- leiningen — система автомитизации и менеджер зависимостей.
- planck — ClojureScript REPL
Библиотеки:
OlderNewer