This file contains 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 | |
declare(strict_types=1); | |
namespace App; | |
use Psr\Http\Message\ResponseInterface; | |
use Psr\Http\Message\ServerRequestInterface; | |
class Runner |
This file contains 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
function getInstagramImages($username, $limit = 5) { | |
$url = 'https://www.instagram.com/'.$username; | |
$response = file_get_contents($url); | |
if (!preg_match('|<script type="text\/javascript">window\._sharedData = (.*?);<\/script>|sim', $response, $matches)) { | |
return []; | |
} | |
$json = json_decode($matches[1], true); | |
$edges = $json['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']['edges']; | |
$images = []; | |
for($i = 0; $i<$limit; $i++) { |
This file contains 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
# Install git fame | |
gem install git_fame | |
# Install all vendors with source | |
rm -rf vendor/* | |
composer update --prefer-source | |
# Do the calculations. This might take 30 minutes to complete. | |
rm output.txt | |
find ./vendor -type d -depth 2 ! -path "./vendor/composer" -exec echo {} \; -exec git fame --sort=loc --hide-progressbar --repository={} \; >> output.txt |
This file contains 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
echo "Remove vendor folder" | |
rm -rf ./vendor/* | |
echo "Get all vendors again but with the .git folder | |
composer install --prefer-source | |
echo "Find a list of all repositories Tobias Nyholm has contributed to | |
find . -name .git -type d -prune -exec bash -c "cd '{}' && git shortlog -snc | grep 'Tobias Nyholm' > /dev/null && echo '{}' " \; |
This file contains 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
Statistics based on master 2017-01-18 08:00:00 UTC | |
Active files: 5,534 | |
Active lines: 662,427 | |
Total commits: 27,200 | |
Note: Files matching MIME type image, binary has been ignored | |
Created by https://github.com/oleander/git-fame-rb | |
+----------------------------------------------------+---------+---------+-------+--------------------+ |
This file contains 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 | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\Config\FileLocator; | |
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | |
use Symfony\Component\DependencyInjection\Dumper\PhpDumper; | |
use Psr\Http\Message\RequestInterface; | |
use Happyr\Geocoder\Middleware\Middleware; | |
use Relay\RelayBuilder; | |
use Zend\Diactoros\Response; |
This file contains 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
add_action('aal_insert_log', 'storeActivityToFile'); | |
function storeActivityToFile($args) { | |
// Example | |
$args = array( | |
'action' => 'activated', | |
'object_type' => 'Plugin', | |
'object_subtype' => '', | |
'object_name' => 'Activity Log', | |
'object_id' => 0, |
This file contains 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 | |
require 'vendor/autoload.php'; | |
$dir = '/Users/tobias/path'; | |
$finder = new \Symfony\Component\Finder\Finder(); | |
$finder->files()->in($dir)->depth('== 0')->name('*.csv'); | |
/** @var \Symfony\Component\Finder\SplFileInfo $file */ |
This file contains 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
{# Check if we got a session without creating one #} | |
{% if app.request.hasPreviousSession %} | |
{# Check if we got some flash messages #} | |
{% if app.session.flashbag.peekAll()|length > 0 %} | |
<div id="flash"> | |
{# Loop all types of flash messages #} | |
{% for type, flashMessages in app.session.flashbag.all() %} | |
{# For all flash messages with this type #} | |
{% for idx, flashMessage in flashMessages %} | |
<div class="flash-item flash-type-{{ type }}"> |