How to run examples:
- Run $ createdb nplusonedb to create DB
- Run specs $ rspec demo.rb
How to run examples:
| ## Found in: http://blog.firsthand.ca/2010/09/ruby-rdoc-example.html | |
| # * Style guide based on Rails documention | |
| module Namespace #:nodoc: don't document this | |
| # Generic Namespace exception class | |
| class NamespaceError < StandardError | |
| end | |
| # Raised when... |
| <?php namespace App\Http\Controllers; | |
| use Illuminate\Http\Request; | |
| trait RestControllerTrait | |
| { | |
| public function index() | |
| { | |
| $m = self::MODEL; | |
| return $this->listResponse($m::all()); |
| This playbook has been removed as it is now very outdated. |
| #Main frontend | |
| frontend app 0.0.0.0:80 | |
| mode tcp | |
| # allow for many connections, with long timeout | |
| maxconn 200000 | |
| timeout client 86400000 | |
| default_backend webapp | |
| # two URLs need to go to the node pubsub backend |
| // Extract a PAK file (from Quake 1 and 2) | |
| #include <errno.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <sys/stat.h> | |
| typedef struct { | |
| char id[4]; |
| # Pass in the name of the site you wich to create a cert for | |
| domain_name = ARGV[0] | |
| if domain_name == nil | |
| puts "Y U No give me a domain name?" | |
| else | |
| system "openssl genrsa -out #{domain_name}.key 1024" | |
| system "openssl req -new -key #{domain_name}.key -out #{domain_name}.csr -subj '/C=US/ST=NJ/L=Monroe/O=MyCompany/OU=IT/CN=#{domain_name}'" | |
| system "cp #{domain_name}.key #{domain_name}.key.bak" |
| var express = require('express'); | |
| var redis = require('redis'); | |
| const serverType = process.argv[2]; | |
| const serverHost = process.argv[3]; | |
| const serverPort = parseInt(process.argv[4]); | |
| const redisPort = 6379; | |
| const redisHost = '127.0.0.1'; |
| # put in config/application.rb | |
| config.to_prepare do | |
| ::PagesController.module_eval do | |
| caches_page :show, :unless => proc {|c| c.user_signed_in? || c.flash.any? } | |
| caches_page :home, :unless => proc {|c| c.user_signed_in? || c.flash.any? } | |
| end | |
| ::Page.module_eval do | |
| after_save :clear_static_caching! | |
| after_destroy :clear_static_caching! |
| God.watch do |w| | |
| w.name = "mysqld" | |
| w.interval = 30.seconds # default | |
| w.start = "service mysql start" | |
| w.stop = "service mysql stop" | |
| w.restart = "service mysql restart" | |
| w.start_grace = 20.seconds | |
| w.restart_grace = 20.seconds | |
| w.pid_file = "/var/lib/mysql/hostname.pid" | |