Skip to content

Instantly share code, notes, and snippets.

View GuillaumeJasmin's full-sized avatar

Guillaume Jasmin GuillaumeJasmin

View GitHub Profile
@GuillaumeJasmin
GuillaumeJasmin / createBatchActions.js
Last active March 17, 2019 20:09
Batch actions async for redux-batched-actions
import { isPlainObject } from 'lodash';
import { batchActions as batchActionsDefault } from 'redux-batched-actions';
const handleInnerAction = (action, getState) => {
if (typeof action === 'function') {
return new Promise(resolve => {
const innerDispatch = innerAction => resolve(handleInnerAction(innerAction, getState));
action(innerDispatch, getState);
});
} else if (isPlainObject(action)) {
@GuillaumeJasmin
GuillaumeJasmin / usefull-linux-commands.md
Created October 31, 2017 10:43
Usefull Linux commands

list all size of directory, sort by size

du -sh * | sort -hr
@GuillaumeJasmin
GuillaumeJasmin / docker-commands.md
Last active March 27, 2018 08:12
List of common Docker commands

Build

docker build . -t <IMAGE_NAME>

OR

docker build . -t <IMAGE_NAME>:<VERSION>

If version is not specifed, latest is set.

@GuillaumeJasmin
GuillaumeJasmin / reduxSetProperty.js
Last active July 4, 2017 02:28
In Redux, we create several codes with the same pattern for one or more properties. If the reducers have many properties, the work is very repeatable. This file makes it possible to write less code and save time
/*_________________________________________________________________
*
* Examples
*_________________________________________________________________
*/
/**
* React Components
*/
this.props.actions.setProperties({
@GuillaumeJasmin
GuillaumeJasmin / reduxSetProperty.js
Created May 18, 2017 18:10
In Redux, we create many code with the same pattern for update one or multiple properties. If the reducers has many property, the work is very repeatable. This make possible to write less code and save time
/*_________________________________________________________________
*
* Examples
*_________________________________________________________________
*/
/**
* Components
*/
this.props.actions.setProperties({
@GuillaumeJasmin
GuillaumeJasmin / panGesture.m
Created March 26, 2015 09:16
panGesture iOS
/**
* listener for pan gesture
*/
- (void)panListener
{
UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panHandler:)];
[self.view addGestureRecognizer:panGestureRecognizer];
}
/**
@GuillaumeJasmin
GuillaumeJasmin / pref.json
Created October 7, 2014 13:02
Sublime Text Predawn Theme user preferences
{
"color_scheme": "Packages/Predawn/predawn.tmTheme",
"findreplace_small": true,
"font_size": 12.0,
"ignored_packages":
[
"Vintage",
"Syntax Highlighting for Sass",
"SublimeLinter"
],
@GuillaumeJasmin
GuillaumeJasmin / template.php
Last active August 29, 2015 14:02
Templating php
$content = "I'm {{name}}, I live in {{location}}";
$var['name'] = 'Max';
$var['location'] = 'Paris';
preg_match_all('|{{(.*?)}}|',$content, $matches);
foreach ($matches[1] as $key => $value) {
$content = str_replace('{{' . $value . '}}', $var[$value], $content);
}
// get screen size after screen rotation
[UIApplication sharedApplication].keyWindow.rootViewController.view.bounds.size;
@GuillaumeJasmin
GuillaumeJasmin / jquery.custom.admin.js
Created June 1, 2014 17:42
fix bug from wordpress theme: Syntac -Wordpress Premium Personal Portfolio
jQuery(function ($) {
jQuery('td.description').hide();
jQuery('td.select_video input').each(function () {
$this = jQuery(this);
if ($this.is(':checked')) {
$this.parent().parent().find('td.description').show();
$this.parent().parent().find('td.image_upload').hide();
}else {
$this.parent().parent().find('td.description').hide();