This file contains hidden or 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
REDIRECT_STATUS=CGI SCRIPT_FILENAME=./index.php php-cgi -d include_path="./inc:$(php -r 'echo get_include_path();')" |
This file contains hidden or 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
prove -vr t 2> >(while read line; do echo -e "\e[01;31m$line\e[0m" >&2; done) |
This file contains hidden or 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 v6; | |
# Hex => Dec | |
:16("ff").base(10); # 255 | |
# Dec => Bin | |
:10("10").base(2); # 1010 | |
# Bin => Hex | |
:2("1111").base(16); # F |
This file contains hidden or 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; | |
use warnings; | |
use Test::More; | |
# See `perldoc -f pack` for documentation. | |
subtest 'Test unsigned char (8-bit)' => sub { | |
my $packed = pack('B8', '0001'.'1111'); |
This file contains hidden or 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
.PHONY: clean test nm | |
CFLAGS=-Wall -Werror -O3 -I. -fPIC | |
all: build/libexample.so build/libexample.a nm | |
build: | |
-mkdir -p build | |
build/libexample.so: build/example.o |
This file contains hidden or 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 common::sense; | |
use Data::Dumper; | |
sub quicksort { | |
my ($array, $left, $right) = @_; | |
return if $left >= $right; | |
my $pivot = $array->[int(($left + $right) / 2)]; | |
my ($i, $j) = ($left, $right); |
This file contains hidden or 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 filter_url($url) { | |
$uri = parse_url($url); | |
$uri['host'] = 'hogefuga.cn'; | |
$new_url = sprintf('%s://%s', $uri['scheme'], $uri['host']); | |
if (array_key_exists('port', $uri)) { |
This file contains hidden or 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
const queries = [ | |
["SET FOREIGN_KEY_CHECKS=0", []], | |
["TRUNCATE TABLE foo", []], | |
["INSERT INTO foo (id, name) VALUES (?, ?)", [1, "foooo"]], | |
["TRUNCATE TABLE bar", []], | |
["INSERT INTO bar (id, name) VALUES (?, ?)", [2, "baaaar"]], | |
["SET FOREIGN_KEY_CHECKS=1", []] | |
] | |
const db = mysql.createConnection(...) |
This file contains hidden or 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
import expect from 'expect' | |
import fs from 'fs' | |
import http from 'http' | |
import sinon from 'sinon' | |
import { parseString } from 'xml2js' | |
const parseXML = (url, callback) => { | |
parseXML.get( | |
url, | |
(err, res, xml) => { |
This file contains hidden or 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
const bodyParser = require('body-parser') | |
const csrf = require('csurf') | |
const expect = require('expect') | |
const express = require('express') | |
const request = require('supertest') | |
const session = require('cookie-session') | |
const createApp = () => { | |
const app = express() | |
app.use(bodyParser.urlencoded({ extended: false })) |