Skip to content

Instantly share code, notes, and snippets.

View c9s's full-sized avatar

c9s

  • Taipei, Taiwan
  • 02:39 (UTC +08:00)
  • X @c9s
View GitHub Profile
<?php
require 'vendor/autoload.php';
use SQLBuilder\RawValue;
use SQLBuilder\ToSqlInterface;
use SQLBuilder\ArgumentArray;
use SQLBuilder\Query\InsertQuery;
use SQLBuilder\Query\SelectQuery;
use SQLBuilder\Query\SelectQueryX;
use SQLBuilder\Driver\MySQLDriver;
php benchmarks/serializer.php
n=30000
Runing json_encode - . 83464.528488116/s
Runing json_decode - . 59165.647102636/s
Runing serialize - . 76887.615465133/s
Runing unserialize - . 63165.897104579/s
Runing yaml_emit - . 26203.323636738/s
Rate Mem json_encode serialize unserialize json_decode yaml_emit
json_encode 83.46K/s 0B -- -92% -75% -70% -31%

Perl5: method based tracing for JIT (just in time complation)

During the execution:

  • Trace and collect the argument types for the method and the return value type. (some method returns mixed type variable, we should ignore that kind of the method)
  • Add the type signature to the method, each type signature refers to the compiled machine code.
  • Calculate the execution times of a method and see if it exceeds the threshold.

When compiling a method, the compiler:

<?php
class Token
{
public $type;
public $val;
public function __construct($type, $val) {
$this->type = $type;
$this->val = $val;
" Vim color file
" Author: Yo-An Lin <yoanlin93@gmail.com>
" Last Change: 2015-2-26
" Version: 1.0
" GUI only
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
@c9s
c9s / SassMeister-input.scss
Created May 2, 2015 07:11
Generated by SassMeister.com.
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
.zoo {color: #ccc; background: #000; width: calc( 100% - 30px); }
.zoo {color: #ccc; background: #000; width: calc( 100% - 30px); }
.zoo {color: #ccc; background: #000; width: calc( 100% - 30px); }
.zoo {color: #ccc; background: #000; width: calc( 100% - 30px); }
.zoo {color: #ccc; background: #000; width: calc( 100% - 30px); }
@c9s
c9s / GoogleSpreadSheetInviteToSlack.js
Last active August 29, 2015 14:20
InviteToSlack from Google SpreadSheet
/*
The original script: https://github.com/dherbst/slack-invite-script/blob/master/code.js
*/
/*
Get channels from: curl 'https://golang.slack.com/api/channels.list?token={token}' | json_pp
*/
function getInviteChannels() {
return ['C123123123'];
phpbrew install 5.6 +default +bcmath +bz2 +calendar +cli +ctype +dom +fileinfo +filter +json \
+mbregex +mbstring +mhash +pcntl +pcre +pdo +phar +posix +readline +sockets \
+tokenizer +xml +curl +zip +openssl=yes +icu +opcache +fpm +sqlite
@c9s
c9s / -
Created July 19, 2015 15:33
#!/bin/bash
source /etc/profile
ANSI_RED="\033[31;1m"
ANSI_GREEN="\033[32;1m"
ANSI_RESET="\033[0m"
ANSI_CLEAR="\033[0K"
TRAVIS_TEST_RESULT=
TRAVIS_CMD=
<?php
use Kendo\DefinitionStorage;
use SimpleApp\SimpleDefinition;
use SimpleApp\User\NormalUser;
use Kendo\RuleLoader\RuleLoader;
use Kendo\RuleLoader\DefinitionRuleLoader;
use Kendo\RuleMatcher\AccessRuleMatcher;
use Kendo\Operation\CommonOperation;
use Kendo\IdentifierProvider\ActorIdentifierProvider;