Skip to content

Instantly share code, notes, and snippets.

View Bernardstanislas's full-sized avatar
🛫
Taking off

Stanislas Bernard Bernardstanislas

🛫
Taking off
View GitHub Profile
@Bernardstanislas
Bernardstanislas / awesomplete.js
Last active October 1, 2015 11:57
Autocomplete
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var pickList = nextProps.pickList;
var code = nextProps.code;
var newValue = nextProps.value;
var value = this._getValueFromCode(code, pickList);
if ('' === value && newValue) {
value = newValue;
}
this.setState({ value: value });
this._awesomeplete._list = this._extractListFromData(pickList);
@Bernardstanislas
Bernardstanislas / awesomplete.js
Last active October 2, 2015 16:18
Autocomplete
var Autocomplete = {
/**
* Component will mount.
* Check if the Awesomplete library is in the Window object.
*/
componentWillMount: function componentWillMount() {
// Check if Awesomplete is set in Window
if (!window.Awesomplete) {
throw new Error('Please include Awesomplete to your application. See http://leaverou.github.io/awesomplete/ for more information');
}
#!/bin/bash
SSID=$(iwgetid -r)
PROXY="http://172.20.0.9:3128"
if [ "Klee" = "$SSID" ]
then
su stan -c "dbus-launch gsettings set org.gnome.system.proxy mode 'manual'"
rm /home/stan/.atom/.apmrc
# Windows related mounts
UUID=74E0BAE0E0BAA82E /media/windows ntfs uid=1000,gid=1000,dmask=023,fmask=006,exec 0 2
UUID=7C5CBE535CBE0842 /media/data ntfs uid=1000,gid=1000,dmask=023,fmask=006,exec 0 2
@Bernardstanislas
Bernardstanislas / caracteres.json
Created February 9, 2016 10:51
Caratères JSON
{
"A": [
[0,0,0,0,0,0,0],
[0,0,0,1,0,0,0],
[0,0,1,0,1,0,0],
[0,0,1,0,1,0,0],
[0,1,0,0,0,1,0],
[0,1,1,1,1,1,0],
[0,1,0,0,0,1,0],
[1,0,0,0,0,0,1]
import React from 'react';
import TextInput from './TextInput';
const TodoItem = ({text}) => (
<li className="todo">
<div className="view">
<input type="checkbox" className="toggle" />
<label htmlFor="todo">
{text}
@Bernardstanislas
Bernardstanislas / squash-hook.js
Last active April 5, 2016 12:42
Squash hook as a bridge to firebase
import Firebase from 'firebase';
const firebaseRef = new Firebase('https://squanalytics.firebaseio.com');
const pointsRef = firebaseRef.child('points');
const stanPointsRef = pointsRef.child('stan');
const arthurPointsRef = pointsRef.child('arthur');
export default async function (hook) {
const currentTime = new Date();

Manage your web assets with Webpack

As a frontend Javascript developer, managing your source files can quickly get tricky. If Node has a built-in module resolver —require— there is no built-in module resolver in the browsers.

In this article, I will get you started with Webpack, a very powerful tool to organize, compile and package your source files. Webpack is an asset manager that will let you compile, optimize, minify all your files: Javascript, CSS, pictures...

Instead of presenting a Webpack boilerplate or starter kit, I will show you how to build a web application step by step from scratch, so that you will end up with a fully working solution that you are comfortable coding with.

import React, {PropTypes} from 'react';
import ProductCard from '../../molecule/product-card';
import PromoCode from '../../atom/promo-code';
import PaymentForm from '../../molecule/payment-form';
import style from './style.css';
const Cart = ({
productCardProps,
promoCodeProps,