Skip to content

Instantly share code, notes, and snippets.

View LeoLeBras's full-sized avatar
🎯
Focusing

Léo LE BRAS LeoLeBras

🎯
Focusing
View GitHub Profile
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AnimatedImplementation
* @flow
@capaj
capaj / component.js
Last active June 22, 2016 12:40
react stateful function component
import React from 'react'
import {observer} from 'mobx-react'
import {observable} from 'mobx'
const state = observable({
value: 0
})
const Comp = (props) => {
return <div onClick={() => state.value++}>click to increase counter value: {state.value}</div>
@bloodyowl
bloodyowl / redux-light-example.js
Created February 29, 2016 17:12
redux in 14 lines of code
const store = createStore((state = { counter: 0 }, action) => {
switch(action.type) {
case "INCREMENT":
return { counter: state.counter + 1 }
case "DECREMENT":
return { counter: state.counter - 1 }
default:
return state
}
})
@bloodyowl
bloodyowl / example.js
Created December 18, 2015 12:35
fetchURL.js
fetchURL("/").then(({ responseText }) => console.log(responseText))
const request = fetchURL("/")
request.cancel()
request.then(() => console.log("NOT HAPPENING"))
/**
* Sass task
*
*/
gulp.task('sass', function() {
gulp.src([srcDir + 'sass/*.scss'])
.pipe(sass())
.on('error', function (err) {
console.log(err.message + ' on line ' + err.lineNumber + ' in file : ' + err.fileName);
})
import React, { Component } from 'react';
import CheckoutContainer from './containers/CheckoutContainer';
import { createStore, applyMiddleware, combineReducers } from 'redux';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
import * as reducers from './reducers';
import { pouchMiddleware, getState } from './redux-pouchdb';
getState().then(initialState =>{
const createStoreWithMiddleware = applyMiddleware(thunk, pouchMiddleware)(createStore);
@manuhabitela
manuhabitela / compile.js
Last active September 4, 2019 08:51
Checking environment in (node) Sass
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var sass = require('node-sass');
var ENV = process.env.SASS_ENV || 'development';
var file = 'variables.scss';
//if in dev, directly pass file to sass
if (ENV === "development") {
@Lordnibbler
Lordnibbler / pull-request-template.md
Last active October 20, 2022 17:32
Sample Pull Request Template

Status

READY/IN DEVELOPMENT/HOLD

Migrations

YES | NO

Description

A few sentences describing the overall goals of the pull request's commits.

Related PRs