Skip to content

Instantly share code, notes, and snippets.

PHP 7.1.0alpha1 (cli) (built: Jun 28 2016 12:53:16) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.1.0alpha1, Copyright (c) 1999-2016, by Zend Technologies
simple 0.037
simplecall 0.011
simpleucall 0.034
simpleudcall 0.037
mandel 0.140
@voluntas
voluntas / shiguredo.rst
Last active August 29, 2024 11:42
時雨堂コトハジメ
@irace
irace / BIWebViewDelegate.m
Created September 10, 2012 02:51
JavaScript/native bridge for iOS's UIWebView
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSString *urlString = [[request URL] absoluteString];
if ([urlString hasPrefix:@"js:"]) {
NSString *jsonString = [[[urlString componentsSeparatedByString:@"js:"] lastObject]
stringByReplacingPercentEscapes];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
> perl -E 'say "生" & "死"'
生 Life U+751F \xe7\x94\x9f 11100111 10010100 10011111
死 Death U+6B7B \xe6\xad\xbb 11100110 10101101 10111011
愛 Love u+611B \xe6\x84\x9b 11100110 10000100 10011011
<?php
$number_of_workers = 5;
$children = array();
$pair = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_DGRAM, STREAM_IPPROTO_IP);
stream_set_blocking($pair[0], 0);
stream_set_blocking($pair[1], 0);
function do_work($fd) {
$pid = getmypid();
for ($i = 0; $i < 10; $i++) {
@maximebf
maximebf / webtail.py
Created October 21, 2011 13:25
Web tail / tail -f as a webpage using websocket
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver