README
docker-compose run --rm web jekyll new --force .
docker-compose up
Open localhost:4000
# Server App | |
# This file must be in lib/myapp/api.rb | |
module MyApp | |
module Entities | |
class Products < Grape::Entity | |
expose :id, :code, :name, :short_description | |
expose :description, :unless => { :collection => true } | |
expose (:category) { |model, options| model.category.name } | |
expose (:brand) { |model, options| model.brand.name } | |
end |
README
docker-compose run --rm web jekyll new --force .
docker-compose up
Open localhost:4000
<!DOCTYPE html> | |
<html ng-app="myApp"> | |
<head> | |
<meta charset="utf-8"> | |
<title>List & Detail View - AngularJS</title> | |
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<style type="text/css"> | |
.list-group { | |
max-height: 420px; | |
overflow-y:scroll; |
require 'benchmark/ips' | |
def simple_fib(n) | |
return n if [0, 1].include?(n) | |
simple_fib(n - 1) + simple_fib(n - 2) | |
end | |
def rec_fib(n) | |
rec = -> (a, b, n) { n == 0 ? a : rec.call(b, a + b, n - 1) } | |
rec.call(0, 1, n) |
version: '2' | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- ./.data/db:/var/lib/mysql | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: wordpress | |
MYSQL_DATABASE: wordpress |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"image" | |
"image/color" | |
"image/draw" | |
"image/jpeg" | |
"log" |
FROM golang:onbuild | |
EXPOSE 8080 |
package net.primegap.authexample; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import org.apache.http.client.HttpResponseException; | |
import org.apache.http.client.ResponseHandler; | |
import org.apache.http.client.methods.HttpDelete; | |
import org.apache.http.client.methods.HttpPut; | |
import org.apache.http.impl.client.BasicResponseHandler; |
require 'spec_helper' | |
describe Form do | |
context "ActiveRecord" do | |
it { should belong_to(:user) } | |
it { should have_many(:entries) } | |
it { should validate_presence_of(:mail_to_address) } | |
it { should validate_presence_of(:redirect_to_url) } | |
end |
class ApplicationController < ActionController::Base | |
before_filter :set_locale | |
protect_from_forgery | |
def set_locale | |
logger.debug "* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}" | |
I18n.locale = current_user ? current_user.locale : (params[:locale] || extract_locale_from_accept_language_header || I18n.default_locale) | |
logger.debug "* Locale set to '#{I18n.locale}'" | |
end |