Skip to content

Instantly share code, notes, and snippets.

<?php require 'vendor/autoload.php';
use Goutte\Client;
use GuzzleHttp\Client as GuzzleClient;
$client = new Client();
$client->setClient(new GuzzleClient(array(
'timeout' => 60,
'debug' => true,
)));
## host
localhost:9090
## log access and errors to console
errors stderr
log stdout
## if need for https
## openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout cert.key -out cert.crt
#tls cert.crt cert.key
@h-collector
h-collector / Foo.php
Last active November 1, 2023 16:32
Standalone Laravel Queue + Redis example
<?php
namespace Jobs;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Redis\Database as Redis;
class Foo extends Job
{
use InteractsWithQueue;
<?php
namespace App\Entities\Fields;
use App\Entities\Fields\DateTime as DateTimeField;
class Date extends DateTimeField
{
/**
@h-collector
h-collector / Kanji to romaji
Created October 5, 2014 11:42
Kanji to romaji PHP + Kakasi
#!/usr/bin/php
<?php
$descriptorspec = [
0 => ['pipe', 'r'], // stdin
1 => ['file', 'php://stdout', 'w'], // stdout
2 => ['file', 'php://stderr', 'a'], // stderr
];
$kakasi = 'kakasi -i euc -w | kakasi -i euc -Ha -Ka -Ja -Ea -ka';
@h-collector
h-collector / soup-nsfw-tag-filter.css
Created May 13, 2014 22:29
CSS NSFW tag filter for Soup.io mypage
.post_image .imagecontainer{
margin: 0 auto;
background:#fff;
cursor:pointer;
}
.tag-nsfw .imagecontainer img{
opacity:0.1
}
.tag-nsfw .imagecontainer:hover img {
opacity:1.0
@h-collector
h-collector / englishbatoto.js
Created November 20, 2013 15:12
list only english releases on www.batoto.net
(function($){
$(function(){
var eng = true;
$('tr.header').siblings().each(function(){
var row = $(this);
if(row.attr('class').split(' ').length > 1){
eng = row.hasClass('lang_English');
}
if(!eng) row.hide();
});
@h-collector
h-collector / nicovideoddl.js
Last active December 27, 2015 21:19
Download video from nicovideo.jp
(function() {
if (location.href.indexOf("http://www.nicovideo.jp/watch/")!=-1) {
// find "watch/smXXX" style URI
$link = $('link').find('[rel=canonical]');
origURI = $link.length ? $link.attr('href') : window.location.href;
// find title
var $title = jQuery('.videoHeaderTitle');
// collect file information
@h-collector
h-collector / toukocityddl.js
Last active December 27, 2015 21:19
Download video from toukoucity.to and translate category
//beforeall
;(function($) {
if (typeof jQuery.fn.socialbutton === 'undefined'){
$.fn.extend({
socialbutton: function(type, options) {
return $(this);
}
});
}
})(jQuery);
#!/usr/bin/php -Cq
<?php
$dir = isset($argv[1]) ? $argv[1] : __DIR__;
$skip = isset($argv[2]) ? intval($argv[2]) : 0;
$count = 0;
if(is_dir($dir)){
echo "Dir: {$dir}\n";
echo "Skip: {$skip} files\n";
class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {