This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var groupBy = function(data, key) { // `data` is an array of objects, `key` is the key (or property accessor) to group by | |
// reduce runs this anonymous function on each element of `data` (the `item` parameter, | |
// returning the `storage` parameter at the end | |
return data.reduce(function(storage, item) { | |
// get the first instance of the key by which we're grouping | |
var group = item[key]; | |
// set `storage` for this instance of group to the outer scope (if not empty) or initialize it | |
storage[group] = storage[group] || []; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add meta fields support in rest API for post type `Post` | |
* | |
* This function will allow custom parameters within API request URL. Add post meta support for post type `Post`. | |
* | |
* > How to use? | |
* http://mysite.com/wp-json/wp/v2/posts?meta_key=<my_meta_key>&meta_value=<my_meta_value> | |
* | |
* > E.g. Get posts which post meta `already-visited` value is `true`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Rules we follow are from PSR-2 as well as the rectified PSR-2 guide. | |
* | |
* - https://github.com/FriendsOfPHP/PHP-CS-Fixer | |
* - https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md | |
* - https://github.com/php-fig-rectified/fig-rectified-standards/blob/master/PSR-2-R-coding-style-guide-additions.md | |
* | |
* If something isn't addressed in either of those, some other common community rules are |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
const fs = require('fs'); | |
const url = 'https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment'; | |
const textanalyticskey = '<YOUR_TEXT_ANALYTICS_KEY>'; | |
const data = JSON.parse(fs.readFileSync('test.json', 'utf8')); | |
request.post(url, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s https://api.github.com/users/milanboers/repos | grep \"clone_url\" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Auth; | |
use Laravel\Passport\Bridge\AccessToken as BaseToken; | |
use Lcobucci\JWT\Builder; | |
use Lcobucci\JWT\Signer\Key; | |
use Lcobucci\JWT\Signer\Rsa\Sha256; | |
use League\OAuth2\Server\CryptKey; | |
use League\OAuth2\Server\Entities\ClientEntityInterface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disallow everything. | |
User-agent: * | |
Disallow: / | |
# Certain social media sites are whitelisted to allow crawlers to access page markup when links to /images are shared. | |
User-agent: Twitterbot | |
Allow: /images | |
User-agent: facebookexternalhit | |
Allow: /images |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Crea tu propio framework PHP</title> | |
<link rel="stylesheet" href="https://stackedit.io/res-min/themes/base.css" /> | |
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script> | |
</head> | |
<body><div class="container"><h1 id="crea-tu-propio-framework-php">Crea tu propio framework PHP</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package One_Fix_Switch_Theme | |
* @version 1.0 | |
*/ | |
/* | |
Plugin Name: One Fix Switch Theme | |
Plugin URI: https://www.1fix.io | |
Description: Switch theme on certain pages. | |
Author: Yoren Chang |