Skip to content

Instantly share code, notes, and snippets.

Avatar

Sergey Abakumoff sAbakumoff

View GitHub Profile
View login-sample1.js
class LoginForm extends Component {
render() {
const { fields: { username, password }, handleSubmit } = this.props;
return (
<form className="form-horizontal" onSubmit={ handleSubmit(this.props.memberLogin) }>
<div className="form-group">
<input type="text" placeholder="Username" className="form-control" {...username} />
</div>
<div className="form-group">
<input type="password" placeholder="Password" className="form-control" {...password} />
View mod_babel.js
'use strict';
var _sharePostStatus;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var PUBLICIZE_SHARE = 'PUBLICIZE_SHARE';
var PUBLICIZE_SHARE_SUCCESS = 'PUBLICIZE_SHARE_SUCCESS';
var PUBLICIZE_SHARE_FAILURE = 'PUBLICIZE_SHARE_FAILURE';
var PUBLICIZE_SHARE_DISMISS = 'PUBLICIZE_SHARE_DISMISS';
View fancy_babel.js
'use strict';
var _sharePostStatus;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var PUBLICIZE_SHARE = 'PUBLICIZE_SHARE';
var PUBLICIZE_SHARE_SUCCESS = 'PUBLICIZE_SHARE_SUCCESS';
View reducers_alt.js
const PUBLICIZE_SHARE = 'PUBLICIZE_SHARE';
const PUBLICIZE_SHARE_SUCCESS = 'PUBLICIZE_SHARE_SUCCESS';
const PUBLICIZE_SHARE_FAILURE = 'PUBLICIZE_SHARE_FAILURE';
const PUBLICIZE_SHARE_DISMISS = 'PUBLICIZE_SHARE_DISMISS';
function update(state, action, post_status){
var next_state = Object.assign({}, state);
var post = {};
post[action.postId] = post_status;
next_state[action.siteId] = Object.assign({}, next_state[action.siteId], post);
View reducers_ex.js
const PUBLICIZE_SHARE = 'PUBLICIZE_SHARE';
const PUBLICIZE_SHARE_SUCCESS = 'PUBLICIZE_SHARE_SUCCESS';
const PUBLICIZE_SHARE_FAILURE = 'PUBLICIZE_SHARE_FAILURE';
const PUBLICIZE_SHARE_DISMISS = 'PUBLICIZE_SHARE_DISMISS';
const sharePostStatus = {
[ PUBLICIZE_SHARE ]: ( state, { siteId, postId } ) =>
( { ...state, [ siteId ]: { ...state[ siteId ], [ postId ]: {
requesting: true,
} } } ),
View reducer_primer.js
function addTodo(state, action){
var new_state;
if(action.type !== "ADD_TODO")
return state;
if(!state)
new_state=[];
else
new_state=state.slice();
new_state.push(action.item);
return new_state;
View react_samples_list.md
View num_of_deps.R
library("tidyr")
num_of_deps<-tidy_repos %>% select(name, isDev) %>%
group_by(name, isDev) %>% count() %>%
spread(isDev, n, fill=0) %>% ungroup() %>%
select("dependencies"=`0`, "devDependencies"=`1`)
boxplot.stats(num_of_deps$dependencies)$stat
# [1] 1 5 10 20 42
boxplot.stats(num_of_deps$devDependencies)$stat
# [1] 0 5 13 24 52
View filter.R
library("dplyr")
deps<-read.csv("react_deps.csv")
repos<-read.csv("repos.csv")
tidy_repos<-deps %>% inner_join(repos)
temp<-tidy_repos %>% select(dependency) %>% mutate(name=dependency) %>% select(name)
tidy_repos<-tidy_repos %>% anti_join(temp)
View select_react.js
function select_framework(r, emit) {
try{
var package=JSON.parse(r.content);
if(package && package.dependencies){
var deps = Object.keys(package.dependencies);
if(deps.indexOf("react")>=0){
var row = {id:r.id, repo:r.repo, name:package.name};
deps.forEach(function(dep){
emit(Object.assign({}, row, {dependency : dep, isDev : 0 }));
});
You can’t perform that action at this time.