Skip to content

Instantly share code, notes, and snippets.

@jbardon
jbardon / .bash_profile
Last active November 3, 2015 13:14
Update shell variable and maven configuration with proxy settings
# Copy that in ~/.bash_profile
# Call "proxy on|off|status" in your shell
proxy(){
case $1 in
on)
export http_proxy=http://cache.etu.univ-nantes.fr:3128
export https_proxy=https://cache.etu.univ-nantes.fr:3128
sed -ie 's/false/true/g' ~/.m2/settings.xml
git config --global http.proxy http://NUM_ETUDIANT:MDP_ETUDIANT@cache.etu.univ-nantes.fr:3128
@jbardon
jbardon / jquery-promises.js
Created June 28, 2017 09:31
Jquery promises examples
// Single async all
$.when(myFunction)
.then(followingFunction);
// Multiple async call
var promises = [ myFunction(), myFunction() ]
$.when(myFunction)
.apply($, promises)
.then(followingFunction);
<!doctype html>
<html>
<head>
<title>React</title>
</head>
<body>
<script src="https://unpkg.com/react@16.2.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.2.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.24.2/babel.min.js" charset="utf-8"></script>
<script src="https://unpkg.com/fetch@1.1.0/lib/fetch.js" charset="utf-8"></script>
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var nodeResolve = require('resolve');
/**
* Make a browserify bundle
* @param isAppBundle true to bundle application without dependencies, false to bundle dependencies only
* @returns {*} browserify bundle
*/
var makeBundle = function (isAppBundle) {
#language: fr
@BadPractice
Fonctionnalité: Parcours de recherche d'une annonce voiture
Scénario: Recherche d'une annonce de voiture récente
Etant donné je ne suis pas identifié
Et je suis sur la page "accueil"
# Mieux que: je clique sur le champ ayant l'id "Pdl"
Quand je clique sur "Pays de la Loire"
const DatePicker = (props) => <input type="date" onChange={props.handleDateSelected}/>
class DatePickerController extends React.Component {
constructor (props) {
super(props);
this.state = { currentDate: null };
this.handleDateSelected = this.handleDateSelected.bind(this);
}
handleDateSelected ({target}) {
<!-- Skipping all HTML5 boilerplate -->
<script src="https://unpkg.com/react@16.2.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.2.0/umd/react-dom.development.js"></script>
<!-- For JSX support (with babel) -->
<script src="https://unpkg.com/babel-standalone@6.24.2/babel.min.js" charset="utf-8"></script>
<div id="app"></div> <!-- React mounting point-->
<script type="text/babel">
// React.createElement naive implementation (using ES6 features)
function createElement(type, props, ...children) {
return { type, props, children };
}
const Watch = (props) =>
<div>{props.hours}:{props.minutes}</div>;
ReactDOM.render(<Watch hours="Hello" minutes="World"/>, document.getElementById('app'));
// Using JS with React.createElement
React.createElement('form', null,
React.createElement('div', {'className': 'form-group'},
React.createElement('label', {'htmlFor': 'email'}, 'Email address'),
React.createElement('input', {'type': 'email', 'id': 'email', 'className': 'form-control'}),
),
React.createElement('button', {'type': 'submit', 'className': 'btn btn-primary'}, 'Submit')
)
// Using JSX