Skip to content

Instantly share code, notes, and snippets.

@satooshi
satooshi / gist:07101df80354db75c6b8
Created October 10, 2014 08:02
php 5.5.9 ubuntu 14.04 segmentation fault
(gdb) continue
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x000000000070ff48 in zend_std_object_get_class (object=0x35cfb78) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_object_handlers.c:1499
1499 /build/buildd/php5-5.5.9+dfsg/Zend/zend_object_handlers.c: No such file or directory.
@satooshi
satooshi / hello.swift
Created June 5, 2014 17:19
hello Swift
protocol Greeter {
func greet() -> String
}
protocol エンジニャー {
func meo()
}
class Person: Greeter {
var name: String = "kitamura"
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
@satooshi
satooshi / DateTime_createFromFormat.php
Last active August 29, 2015 13:56
! in time format.
<?php
$time = '03/2014';
$dt1 = \DateTime::createFromFormat('m/Y', $time); // "2014-03-19 17:14:38"
$dt2 = \DateTime::createFromFormat('!m/Y', $time); // "2014-03-01 00:00:00"
$dt3 = \DateTime::createFromFormat('m/Y!', $time); // "1970-01-01 00:00:00"
$dt4 = \DateTime::createFromFormat('m!/Y', $time); // "2014-01-01 00:00:00"
var_dump($dt1, $dt2, $dt3, $dt4);
/*
@satooshi
satooshi / DirectoryStructure
Last active September 26, 2021 20:03
Directory structure of Domain Driven Design application with Symfony2, Doctrine2.
sf2-ddd
├── app
├── bin
├── build
├── lib
├── src
│   └── __VendorPrefix
│   ├── Application
│   │   └── __DomainNameBundle
│   │   ├── Command
# workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.php.ui.prefs
eclipse.preferences.version=1
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
editorColorPhpdoc=\#e10071 | | true | false | false | false
editorColorKeyword=\#0000a0 | null | true | false | false | false
editorColorString=\#004000 | null | false | false | false | false
@satooshi
satooshi / coveralls.php
Created April 12, 2013 16:08
I wrote PHP library for Coveralls. https://github.com/satooshi/php-coveralls PHP script for Coveralls. clover.xml generated by PHPUnit is required to get coverage data. And repo_token for Coveralls repository is required for API access.
<?php
// data
/**
* Data represents "source_files" element of Coveralls' "json_file".
*
* @author Kitamura Satoshi <with.no.parachute@gmail.com>
*/
class SourceFile
@satooshi
satooshi / twig.sh
Created April 12, 2013 09:20
php-build plugin for twig extension. put this script into /path/to/php-build/plugins.d/twig.sh
#!/usr/bin/env bash
# PHP.next Development releases depend on current XDebug development
# snapshots.
function install_twig_master {
local source_dir="$TMP/source/twig-master"
local cwd=$(pwd)
local revision=$1
if [ -d "$source_dir" ] && [ -d "$source_dir/.git" ]; then
@satooshi
satooshi / Rakefile
Created April 10, 2013 11:25
pubsub task to notify to Hub server.
desc "notify to PuSH Hub server"
task :pubsub do
require 'net/http'
require 'uri'
hub_url = "http://satooshi.superfeedr.com" # <--- replace this with your hub
atom_url = "http://blog.satooshi.jp/atom.xml" # <--- replace this with your full feed url
resp, data = Net::HTTP.post_form(URI.parse(hub_url),
{'hub.mode' => 'publish',
'hub.url' => atom_url})
@satooshi
satooshi / atom.xml
Created April 10, 2013 11:23
atom.xml applied for PubSubHubbub protocol.
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[{{ site.title }}]]></title>
<link href="{{ site.url }}/atom.xml" rel="self"/>
<link href="{{ site.url }}/"/>
{% if site.hub_url %}<link href="{{ site.hub_url }}" rel="hub"/>{% endif %}
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.url }}/</id>
<author>