Skip to content

Instantly share code, notes, and snippets.

# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
$! raise された例外オブジェクト
$" require で読み込まれたファイルの配列
$#
$$ 現在のプロセス ID
$%
$& 正規表現にマッチした箇所の文字列
$' 正規表現にマッチした箇所より後ろの文字列
$(
$)
$* Ruby スクリプトに指定された引数。ARGV と同じ

Assuming you llvm installed (comes as standard on Mac OS Mavrick xtools)

Create a helloworld.c file:

  #include<stdio.h>
  
  int main()
  {
 int x=3;

ActionFunction の紹介

この記事は Play framework Advent Calendar 2014 の7日目です。

昨日は @dorako321 さんの Play framework Advent Calendar 2014 6日目 位置情報を使ってみよう でした。

明日は @nazoking さんの play2.3 の sbt-web を使わず node で代替システムを作るための資料 です。

さて、そんなこんなで公式ドキュメントではまだ語られていない ActionFunction とそのサブトレイトについて紹介したいと思います。 (公式ドキュメントにも記載ありました https://www.playframework.com/documentation/2.3.x/ScalaActionsComposition#Different-request-types )

@huydx
huydx / 3nightclubs.scala
Last active August 29, 2015 14:27 — forked from oxbowlakes/3nightclubs.scala
A Tale of 3 Nightclubs
/**
* Part Zero : 10:15 Saturday Night
*
* (In which we will see how to let the type system help you handle failure)...
*
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0)
*/
import scalaz._
import Scalaz._
@huydx
huydx / pgessays.py
Created November 18, 2012 15:57 — forked from olasitarska/pgessays.py
Builds epub book out of Paul Graham's essays.
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
import re, ez_epub, urllib2, genshi
@huydx
huydx / oshi.rb
Created February 5, 2013 16:03 — forked from anonymous/oshi.rb
require 'rubygems'
require 'eventmachine'
require 'em-websocket'
require 'json'
class Connection
attr_accessor :socket, :user_id
def initialize(socket, user_id)
@socket = socket
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby