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
FROM php:7.4-cli-alpine | |
# Install xdebug | |
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \ | |
&& pecl install xdebug \ | |
&& docker-php-ext-enable xdebug \ | |
&& apk del .phpize-deps | |
WORKDIR /var/www/html |
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 | |
function multiple_download(array $urls, $save_path = '/tmp') | |
{ | |
$multi_handle = curl_multi_init(); | |
$file_pointers = []; | |
$curl_handles = []; | |
// Add curl multi handles, one per file we don't already have | |
foreach ($urls as $key => $url) { |
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
// Note: only for modern browser | |
import axios from 'axios' | |
// helper function: generate a new file from base64 String | |
const dataURLtoFile = (dataurl, filename) => { | |
const arr = dataurl.split(',') | |
const mime = arr[0].match(/:(.*?);/)[1] | |
const bstr = atob(arr[1]) | |
let n = bstr.length | |
const u8arr = new Uint8Array(n) |
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
"scripts": { | |
"serve": "vue-cli-service serve", | |
"build:admin": "rimraf vue.config.js && copy vue.configAdmin.js vue.config.js && vue-cli-service build --dest dist/admin src/admin/main.js && rimraf vue.config.js && copy vue.configDefault.js vue.config.js", | |
"build:client": "rimraf vue.config.js && copy vue.configClient.js vue.config.js && vue-cli-service build --dest dist/client src/client/main.js && rimraf vue.config.js && copy vue.configDefault.js vue.config.js", | |
"lint": "vue-cli-service lint" | |
}, |
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 bzr and gource | |
# get a branch of Mir's trunk code | |
# create gource video | |
$ sudo apt-get install bzr gource | |
$ bzr branch lp:mir | |
$ cd mir | |
$ gource \ | |
-s .06 \ |
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
/* | |
* Trying to feature-detect (very naive) | |
* CSS Flexbox support. | |
* - Only most modern syntax | |
* | |
* Is this nonsense? | |
*/ | |
(function NaiveFlexBoxSupport(d){ | |
var f = "flex", e = d.createElement('b'); |
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 | |
$apnsHost = 'gateway.sandbox.push.apple.com'; | |
$apnsCert = 'ck.pem'; | |
$apnsPort = 2195; | |
$apnsPass = '<PASSWORD_GOES_HERE>'; | |
$token = '<DEVICE_TOKEN_GOES_HERE>'; | |
$payload['aps'] = array('alert' => 'Oh hai!', 'badge' => 1, 'sound' => 'default'); | |
$output = json_encode($payload); |
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
'use strict'; | |
function getNextPositions(start) { | |
var moves = [ | |
{ x: -2, y: -1 }, | |
{ x: -2, y: +1 }, | |
{ x: -1, y: -2 }, | |
{ x: -1, y: +2 }, | |
{ x: +1, y: -2 }, | |
{ x: +1, y: +2 }, |
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 | |
/** | |
* Negabase | |
* To convert a decimal to negative base. | |
* Divide the number by the negative base. | |
* Acquire the whole number quotient and remainder. | |
* If the remainder is negative, add 1 to the quotient and add the absolute value of the base to the remainder. | |
* Divide the quotient by the negative base... rinse and repeat until the quotient is 0. | |
* Aggregate the remainders in reverse (as a stack), and you have your negative base representation. |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="Composer Targets" default="build"> | |
<property name="builddir" value="${basedir}/build"/> | |
<property name="composer" value="${builddir}/composer.phar"/> | |
<target name="php-check"> | |
<condition property="php" value="php"> | |
<not> | |
<isset property="${php}"/> |
NewerOlder