Skip to content

Instantly share code, notes, and snippets.

@flozz
flozz / Makefile
Last active January 8, 2022 17:26
Builds a frozen version of WeasyPrint that includes all required dependencies and libraries.
# Builds a frozen version of WeasyPrint (https://github.com/kozea/weasyprint)
# that includes all required dependencies and libraries.
#
# Dependencies:
#
# * GNU make (build-essential package on Debian)
# * Python headers (python3-dev package on Dabian)
# * virtualenv
#
# Usage:
@christeredvartsen
christeredvartsen / test.php
Created January 3, 2017 07:15
Use a callback for return values with a mock in PHPUnit
<?php
class SomeClass { public function someMethod() {} }
class SomeClassTest extends PHPUnit_Framework_TestCase {
public function testSomeMethod() {
$someValue = ' ... ';
$mock = $this->createMock('SomeClass');
$mock
->expects($this->once())
@nanoninja
nanoninja / jose_jwt_go_usage.md
Created September 29, 2016 14:35
JOSE - JWT Usage Examples

JOSE - JWT Usage Examples

JOSE is a comprehensive set of JWT, JWS, and JWE libraries.

jwt.io

Installation

go get github.com/SermoDigital/jose
@nathan-osman
nathan-osman / win32.go
Last active July 18, 2024 16:55
Simple Windows GUI application written in Go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
@albulescu
albulescu / download.go
Created March 25, 2016 09:44
golang download file with progress
package main
/**
* @website http://albulescu.ro
* @author Cosmin Albulescu <cosmin@albulescu.ro>
*/
import (
"bytes"
"fmt"
@staltz
staltz / migration-guide.md
Last active December 19, 2023 22:14
How to show migration guides in GitHub Markdown

How to show migration guides in GitHub Markdown

Use the diff code highlighting tag.

  ```diff
  - foo
  + bar

Example:

@rayrutjes
rayrutjes / Dockerfile
Created August 9, 2015 11:52
Official php dockerfile with xdebug
FROM php:5.6-fpm
RUN curl -L -o /tmp/xdebug-2.3.3.tgz http://xdebug.org/files/xdebug-2.3.3.tgz \
&& tar xfz /tmp/xdebug-2.3.3.tgz \
&& rm -r /tmp/xdebug-2.3.3.tgz \
&& mv xdebug-2.3.3 /usr/src/php/ext/xdebug \
&& docker-php-ext-install xdebug
CMD ["php-fpm"]
@ruario
ruario / README.md
Last active January 7, 2023 20:52
Installs (or updates) PPAPI Flash, so that it can be used by Chromium-based browsers

Usage

If you use Ubuntu or a derivative distro, issue the following to install an appropriate version of Flash:

sudo add-apt-repository "deb http://archive.canonical.com/ubuntu `lsb_release -cs` partner" 
sudo apt update
sudo apt install adobe-flashplugin

If your distro does not provide a copy of Pepper Flash that works with Vivaldi, this script will download and install it for you. To use, click on the "Download ZIP" button listed on the GitHub Gist page and then unpack the .zip archive locally. You should now have a directory containing the file "latest-pepper-flash.sh".

typeof(+undefined|0)
typeof(+NaN|0)
typeof(+null|0)
typeof(+0|0)
typeof(+[]|0)
typeof(+{}|0)
typeof(+"2"|0)
typeof(+1|0)
// +yourValue|0
@dbu
dbu / CaseInsensitiveStringFilter.php
Last active July 18, 2023 18:04
Case insensitive filtering with sonata admin in postgres
<?php
namespace Liip\AcmeBundle\Filter;
use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\DoctrineORMAdminBundle\Filter\StringFilter;
class CaseInsensitiveStringFilter extends StringFilter
{