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 | |
# Flatten array and modify it's value | |
# [[1, 2, 3, 4, [3, 4]] => [1, 2, 3, 4, 3, 4] | |
# php ./script.php to test | |
$total = 30000; | |
$mockData = []; | |
for($i = 1; $i < $total; $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
{% use "form_div_layout.html.twig" %} | |
{# Widgets #} | |
{% block form_widget_simple -%} | |
{% if type is not defined or 'file' != type %} | |
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} | |
{% endif %} | |
{{- parent() -}} | |
{%- endblock form_widget_simple %} |
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 "web:Form:bootstrap_4_layout.html.twig" %} | |
{# Labels #} | |
{% block form_label -%} | |
{% if label is same as(false) %} | |
<div class="{{ block('form_label_class') }}"></div> | |
{% else %} | |
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %} | |
{{- parent() -}} |
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
#!/bin/bash | |
# https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880 | |
sudo install -o root -g root -m 0600 /dev/null /swapfile | |
dd if=/dev/zero of=/swapfile bs=1k count=2048k | |
mkswap /swapfile | |
swapon /swapfile | |
echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab | |
sudo sysctl -w vm.swappiness=10 | |
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf |
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 | |
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <sean@iamseanmurphy.com> | |
* @copyright Copyright 2012 Sean Murphy. All rights reserved. |
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
#!/bin/bash | |
# make sure you switch to php70 | |
brew unlink php56 && brew link php70 | |
# checkout and build | |
git clone git@github.com:krakjoe/apcu | |
cd apcu | |
make clean |
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
############################################################################# | |
# current prompt | |
############################################################################# | |
# \d – Current date | |
# \t – Current time | |
# \h – Host name | |
# \# – Command number | |
# \u – User name | |
# \W – Current working directory (ie: Desktop/) | |
# \w – Current working directory, full path (ie: /Users/Admin/Desktop) |
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 | |
namespace Entities\meta\Functions; | |
use Doctrine\ORM\Query\Lexer; | |
use Doctrine\ORM\Query\AST\Functions\FunctionNode; | |
/** | |
* "CONVERT" "(" ArithmeticPrimary AliasResultVariable AliasResultVariable ")". | |
* More info: | |
* http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html#function_convert |
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
var fs = require("fs"); | |
var dir = __dirname+"/functions"; | |
/** | |
* Build packages by you want. | |
* Added by ツ Liverbool | |
* | |
* List of packages | |
* @see https://github.com/kvz/phpjs/tree/master/functions |
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
#!/bin/bash | |
locale-gen en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
echo 'Asia/Bangkok' | sudo tee /etc/timezone | |
apt-get update | |
apt-get install -y python-software-properties curl zsh git nodejs npm ruby-dev gem && \ |
NewerOlder