Skip to content

Instantly share code, notes, and snippets.

View suin's full-sized avatar
😃

suin

😃
View GitHub Profile
@agemooij
agemooij / SnakifiedSprayJsonSupport.scala
Last active November 18, 2020 14:34
An example of how to customize the field mapping in spray-json to do generic transformation, in this case translating between camelcased Scala attributes and snakecase JSON attributes
/**
* The MIT License (MIT)
*
* Copyright (c) 2013-2015 Andrew Snare, Age Mooij
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
cluster = require("cluster")
domain = require("domain")
express = require("express")
os = require("os")
if cluster.isMaster
cluster.fork() for cpu in os.cpus()
// Fork new worker if one dies
else
<?php
/**
* A simple description for this script
*
* PHP Version 5.2.0 or Upper version
*
* @package SampleGetBlockContent
* @author Hidehito NOZAWA aka Suin <http://ryus.co.jp>
* @copyright 2010 Hidehito NOZAWA
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2