Skip to content

Instantly share code, notes, and snippets.

@hirak
hirak / file0.php
Created March 7, 2013 16:27
PHPで列挙型(enum)を作る ref: http://qiita.com/items/71e385b56dcaa37629fe
<?php
abstract class Enum
{
private $scalar;
function __construct($value)
{
$ref = new ReflectionObject($this);
$consts = $ref->getConstants();
if (! in_array($value, $consts, true)) {
@kenjiskywalker
kenjiskywalker / nginx_try_files_memo.md
Last active April 13, 2024 03:00
nginxのtry_filesの動作の確認

nginx config

nginx.conf

server {
    listen 80;
    server_name example.com;
    root /var/www/html/;
    index index.html;
    access_log /var/log/nginx/access_log hogehoge;
@JeffreyWay
JeffreyWay / set-value.md
Created July 28, 2012 19:09
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
@madankumarpc
madankumarpc / minimal3.html
Created July 27, 2012 15:50
Css examples for table
<html>
<style>
#ver-minimalist
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-
Serif;
font-size: 12px;
margin: 45px;
width: 480px;
@kig
kig / workcrew.js
Created September 2, 2011 11:03
WorkCrew - a WebWorker work queue library
/*
WorkCrew - a WebWorker work queue library
Usage:
// Create an 8 worker pool using worker.js.
var crew = new WorkCrew('worker.js', 8);
// Do something whenever a job is completed.
// The result object structure is