- Could code splitting split my CSS by component, page ets.
- Why not use bootstrap
- Mobile first over desktop first / you choose
- responsive?
- colors aren't really important as they change on a per project basis
| // add Promise.map that resolves your promises in a map. | |
| Object.assign(Promise, { | |
| map: function(objectPromiseMap) { | |
| var keys = Object.keys(objectPromiseMap); | |
| return new Promise(function(resolve) { | |
| Promise.all( | |
| keys.map(function(key) { | |
| return objectPromiseMap[key].catch(function(error) { | |
| return Promise.resolve(error); | |
| }); |
What I am thinking about is how to set up a message queue that will not only take messages with deadline / dates but also will know how to notify the parent process of the relevant event that has now become executable.
The requirements I have or this task runner is simple. It should store a task name in the database with either a local date or deadline. If a process deadline is close to becoming relevant the task runner should priorotize this task. The task runner need not be a part of the existing application. The date of the task is the date that determines when a task becomes active.
I appreciate what flux has done with their uni-directional flow of data in an application. I believe that the backend can benifit from such an approach.
I created this gist because of a recent question I asked in Z.A. Tech's slack channel.
I said: Hey node people. I have a question about Promise vs Async waterfall. What do you think is more readable? option 1:
function (done) {
DataModel.find({ owner: user._id }, function (err, response) {
done(err, response);
| <?php | |
| namespace App\Jobs; | |
| use Illuminate\Bus\Queueable; | |
| use Illuminate\Queue\SerializesModels; | |
| use Illuminate\Queue\InteractsWithQueue; | |
| use Illuminate\Contracts\Queue\ShouldQueue; | |
| use Mailchimp; |
#Last used by editor December 2016
#Setting up node
echo "installing node"
cd ~
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
nano nodesource_setup.sh
sudo bash nodesource_setup.sh
#INSTAGRAM HELPERS
Get username id: https://smashballoon.com/instagram-feed/find-instagram-user-id/
Getting an access token: http://www.benrlodge.com/blog/post/how-to-generate-an-instagram-access-token
##NOT RECOMENDED
| <?php | |
| /** | |
| * @return string | |
| */ | |
| function html_excerpt($string,$length=150,$ending="…") { | |
| $opening_regex = '/((?:<[a-zA-Z0-9="\':.,;\-() ]*>)*)(.*)/'; | |
| $closing_regex = '/(<\/[a-zA-Z0-9="\':.,;\-() ]*>)/'; | |
| $string = trim($string); | |
| $str_len = 0; |
| private function delete_dir($dirPath) | |
| { | |
| if (! is_dir($dirPath)) | |
| { | |
| throw new InvalidArgumentException("$dirPath must be a directory"); | |
| } | |
| if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') | |
| { | |
| $dirPath .= '/'; | |
| } |
| function recurse_copy($src,$dst) { | |
| $dir = opendir($src); | |
| @mkdir($dst); | |
| while(false !== ( $file = readdir($dir)) ) { | |
| if (( $file != '.' ) && ( $file != '..' )) { | |
| if ( is_dir($src . '/' . $file) ) { | |
| recurse_copy($src . '/' . $file,$dst . '/' . $file); | |
| } | |
| else { | |
| copy($src . '/' . $file,$dst . '/' . $file); |