create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| /*! ****************************** | |
| Handlebars helpers | |
| *******************************/ | |
| // debug helper | |
| // usage: {{debug}} or {{debug someValue}} | |
| // from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/) | |
| Handlebars.registerHelper("debug", function(optionalValue) { | |
| console.log("Current Context"); | |
| console.log("===================="); |
| Number.prototype.timeLeft = function(){ | |
| var days = Math.floor(this / 86400); | |
| var hours = Math.floor((this - (days * 86400)) / 3600); | |
| var minutes = Math.floor((this - ((hours * 3600) + (days * 86400))) / 60); | |
| var seconds = this - ((days * 86400) + (hours * 3600) + (minutes * 60)); |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| var now = new Date(); | |
| var quarter = Math.floor((now.getMonth() / 3)); | |
| var firstDate = new Date(now.getFullYear(), quarter * 3, 1); | |
| var endDate = new Date(firstDate.getFullYear(), firstDate.getMonth() + 3, 0); |
| var exec = require('child_process').exec, | |
| url = "http://google.com/", | |
| timeout = "3", | |
| data="?q=test"; | |
| var time = process.hrtime(); | |
| exec('curl --max-time ' + timeout + ' -d \'' + data + '\' ' + url, function (error, stdout, stderr) { | |
| var diff = process.hrtime(time); | |
| //console.log('stdout: ' + stdout); | |
| //console.log('stderr: ' + stderr); |
| <?php | |
| /** | |
| * Sync Groups from WordPress to Discourse | |
| * | |
| * First creates 'groups' meta_key (which should be customized to your needs) | |
| * Then it monitors for changes in the 'groups' meta_value and connects to Discourse API to sync groups | |
| * | |
| * WordPress References | |
| * https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/meta.php?order=name#L235 | |
| * http://wordpress.stackexchange.com/questions/16835/how-to-hook-update-post-meta-and-delete-post-meta |
| var slackTeam = "YOUR_SLACK_TEAM_NAME "; | |
| var token = 'YOUR_ADMIN_TEST_TOKEN'; | |
| // A test token will suffice. | |
| // You can generate one at https://api.slack.com/docs/oauth-test-tokens | |
| // Just make sure that the user issuing the test token is an admin. | |
| var url = 'https://'+ slackTeam + '.slack.com/api/users.admin.invite'; | |
| fetch(url, { | |
| method: 'POST', | |
| headers: {'Content-Type': 'application/x-www-form-urlencoded'}, |
| <?php | |
| // array | |
| $array = Array ( | |
| "0" => Array ( | |
| "id" => "USR1", | |
| "name" => "Steve Jobs", | |
| "company" => "Apple" | |
| ), | |
| "1" => Array ( | |
| "id" => "USR2", |
| <?php | |
| /** | |
| * Regsiter script | |
| */ | |
| add_action( 'wp_enqueue_scripts', function() { | |
| // Set dependency to wp-api, which has nonce and endpoint root. | |
| wp_enqueue_script( 'api-handler', '/path/to/api-handler.js', [ 'jquery', 'wp-adpi' ], '1.0', true ); | |
| } ); |