Skip to content

Instantly share code, notes, and snippets.

Christian Rishøj crishoj

Block or report user

Report or block crishoj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@crishoj
crishoj / tl-privacy.md
Created Aug 14, 2019
Privacy Policy for Thai-English Dictionary from Thai-language.com
View tl-privacy.md

Christian Rishøj built the Thai-English Dictionary from Thai-language.com app as a free app.

No personal information is collected by the app, and no third party services are used.

Log data remains on the device on which the app is installed, and is not transmitted elsewhere.

Please direct any questions or suggestions to christian@rishoj.net.

@crishoj
crishoj / output.txt
Last active Jul 22, 2018
ImageMagick pixel color extraction from CMYK image
View output.txt
##
## Ubuntu Bionic with PHP 7.2.7 and ImageMagick 6.9.7
##
>>> $resource = new Imagick("tests/images/bookcover.jpg")
=> Imagick {#2286}
>>> $resource->getImagePixelColor(20, 20)->getColor(true)
=> [
"r" => 0.0,
"g" => 0.10196078431373,
@crishoj
crishoj / example.mbox
Created Feb 24, 2018
Example mail triggering `"Undefined property: stdClass::$bytes"` in https://github.com/tedious/Fetch
View example.mbox
Delivered-To: eorder@imusic.dk
Received: by 10.31.170.197 with SMTP id t188csp550289vke;
Fri, 23 Feb 2018 04:34:11 -0800 (PST)
X-Google-Smtp-Source: AG47ELugto9uFG3a2nqQcrY8q4WwyaEz+mG9hxyxkeVPh5KGmyTbm0UPd9SG8RZOaZ1vxuiBSvvW
X-Received: by 10.46.60.22 with SMTP id j22mr1221583lja.27.1519389251617;
Fri, 23 Feb 2018 04:34:11 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1519389251; cv=none;
d=google.com; s=arc-20160816;
b=MRU+m3Y8TuEPD2MQyeabItO2nub+yX8O9IV1wQBO998byTLDMna/ZjylshtbwqdrbG
MxWT1loLMOZI/j/YRANCcZdD8h91xamTe2mog8UJaj139UP31cELoDjR+bzMbhD89x9V
@crishoj
crishoj / EnsureQueueWorkerIsRunning.php
Last active May 27, 2019 — forked from ivanvermeyen/EnsureQueueListenerIsRunning.php
Ensure that the Laravel 5.5 queue worker is running with "php artisan queue:checkup" and restart it if necessary. You can run this automatically with a cron job: http://laravel.com/docs/scheduling
View EnsureQueueWorkerIsRunning.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class EnsureQueueWorkerIsRunning extends Command
{
protected $signature = 'queue:checkup';
protected $description = 'Ensure that the queue worker is running.';
View keybase.md

Keybase proof

I hereby claim:

  • I am crishoj on github.
  • I am crishoj (https://keybase.io/crishoj) on keybase.
  • I have a public key ASAkPv-nLbCvA-deaFI2NKwV47Nz8gQXni4c9VZLCxpWAwo

To claim this, I am signing this object:

@crishoj
crishoj / fast_paginate.php
Created May 17, 2017
Paginate Eloquent query using SQL_CALC_FOUND_ROWS and FOUND_ROWS() — avoids running the query twice
View fast_paginate.php
<?php
function paginateOptimized(Builder $builder, $perPage = null, $pageName = 'page', $page = null): LengthAwarePaginator
{
$model = $builder->getModel();
$page = $page ?: Paginator::resolveCurrentPage($pageName);
$perPage = $perPage ?: $model->getPerPage();
$sql = $builder->forPage($page, $perPage)->toSql();
@crishoj
crishoj / to_sentence.php
Last active Jul 14, 2016 — forked from bluefuton/to_sentence.php
Simple implementation of Rails' .to_sentence for PHP
View to_sentence.php
<?php
if (! function_exists('to_sentence')) {
function to_sentence(array $parts, $connector = ', ', $finally = ' and '): string
{
switch (count($parts)) {
case 0:
return '';
case 1:
return reset($parts);
@crishoj
crishoj / CamelCasedModel.php
Last active Mar 31, 2016
Eloquent base model for schemas with camel-cased tables and fields
View CamelCasedModel.php
<?php
namespace app;
use Illuminate\Database\Eloquent\Model;
class CamelCasedModel extends Model
{
public function getForeignKey()
@crishoj
crishoj / Iconizer.sh
Last active Jul 7, 2016 — forked from steverichey/Iconizer.sh
Create iOS application icons from one PDF file. Requires ImageMagick.
View Iconizer.sh
#!/bin/sh
#
# Iconizer shell script by Steve Richey (srichey@floatlearning.com)
#
# This is a simple tool to generate all necessary app icon sizes and the JSON file for an *EXISTING* Xcode project from one file.
# To use: specify the path to your vector graphic (PDF format) and the path to your Xcode folder containing Images.xcassets
# Example: sh iconizer.sh MyVectorGraphic.pdf MyXcodeProject
#
# Requires ImageMagick: http://www.imagemagick.org/
You can’t perform that action at this time.