This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps
argument of the connect
function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps
can take.
// middleware.js | |
exports.filesUpload = function(req, res, next) { | |
// See https://cloud.google.com/functions/docs/writing/http#multipart_data | |
const busboy = new Busboy({ | |
headers: req.headers, | |
limits: { | |
// Cloud functions impose this restriction anyway | |
fileSize: 10 * 1024 * 1024, | |
} |
Mobile Safari does not support position: fixed
when an input focused and virtual keyboard displayed.
To force it work the same way as Mobile Chrome, you have to use position: absolute
, height: 100%
for the whole page or a container for your pseudo-fixed elements, intercept scroll
, touchend
, focus
, and blur
events.
The trick is to put the tapped input control to the bottom of screen before it activates focus. In that case iOS Safari always scrolls viewport predictably and window.innerHeight
becomes exactly visible height.
Open https://avesus.github.io/docs/ios-keep-fixed-on-input-focus.html in Mobile Safari to see how it works.
Please avoid forms where you have several focusable elements because more tricks to fix position will be necessary, those were added just for demonstration purposes.
/* | |
Logging levels : | |
0 : Show error | |
1 : Show warning | |
2 : Show valid | |
3 : Show info | |
4 : Show debug | |
5 : show verbose | |
[level]Raw : Raw info without time & msg location |
In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:
git remote add upstream https://github.com/whoever/whatever.git
git fetch upstream
/******************************/ | |
/* Bluegrass Event Bus PubSub */ | |
/* from https://davidwalsh.name/pubsub-javascript */ | |
/******************************/ | |
var BGEventBus = (function(){ | |
var topics = {}; | |
var hOP = topics.hasOwnProperty; | |
return { | |
subscribe: function(topic, listener) { |
<?php | |
/* | |
Plugin Name: ACF Customizer Patch | |
Plugin URI: https://gist.github.com/fabrizim/9c0f36365f20705f7f73 | |
Description: A class to allow acf widget fields to be stored with normal widget settings and allow for use in customizer. | |
Author: Mark Fabrizio | |
Version: 1.0 | |
Author URI: http://owlwatch.com/ | |
*/ | |
class acf_customizer_patch |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
<?php | |
function time2str($ts) { | |
if(!ctype_digit($ts)) { | |
$ts = strtotime($ts); | |
} | |
$diff = time() - $ts; | |
if($diff == 0) { | |
return 'now'; | |
} elseif($diff > 0) { | |
$day_diff = floor($diff / 86400); |
<?php | |
//Get data from instagram api | |
$hashtag = 'max'; | |
//Query need client_id or access_token | |
$query = array( | |
'client_id' => '', | |
'count' => 3 | |
); | |
$url = 'https://api.instagram.com/v1/tags/'.$hashtag.'/media/recent?'.http_build_query($query); |