-
We can define customed url helper by
:as
get "/photos/:id", to: "photos#show", as: :"show_photo" <%= link_to 'Photo Record', show_photo_path(15) %> show_photo_path(15)
A foreign key is a column (or columns) that references a column (most often the primary key) of another table.
Add index to foreign key is a good practice if that foreign key is read a lot.
# 1 to 1 association
# create :another_model_id foreign_key in that model
belongs_to :another_model
# 1 to m association
#AngualrJS Note
-
Angular leverage dependency injection to import modules. The key concept is using
Function.toString()
to track params. Inject by its params to achieve loosley coupling architecture also help with the js minify issue.app.controller("MyController", function($scope, $service){ // code in here }); // better use for minify
#Note for Programming in Scala
##Chp.0 SBT & Scala Interpreter
-
Call scala interpreter by
sbt
.// enter scala interpreter
doctype html | |
| <!--[if lt IE 8 ]><html class="no-js preload lt-ie10 lt-ie9 lt-ie8 ie-suck"><![endif]--> | |
| <!--[if IE 8 ]><html class="no-js preload lt-ie10 lt-ie9 ie-8"><![endif]--> | |
| <!--[if IE 9 ]><html class="no-js preload lt-ie10 ie-9"><![endif]--> | |
| <!--[if gt IE 9]><!--> | |
html.no-js | |
| <!--<![endif]--> | |
head | |
meta(charset='utf-8') | |
meta(http-equiv='X-UA-Compatible' content='IE=edge,chrome=1') |
- Quick review of RFC6265
- Origin servers SHOULD NOT fold multiple
Set-Cookie
header fields into a single header field. The usual mechanism for folding HTTP headers fields (i.e., as defined in [RFC2616]) might change the semantics of theSet-Cookie
header field because the%x2C
(",") character is used bySet-Cookie
in a way that conflicts with such folding.
### Testing if the client is a mobile or a desktop. | |
### The selection is based on the usual UA strings for desktop browsers. | |
## Testing a user agent using a method that reverts the logic of the | |
## UA detection. Inspired by notnotmobile.appspot.com. | |
map $http_user_agent $is_desktop { | |
default 0; | |
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule | |
~*spider|crawl|slurp|bot 1; # bots | |
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes |
#!/bin/bash | |
echo "Generating an SSL private key to sign your certificate..." | |
openssl genrsa -des3 -out myssl.key 1024 | |
echo "Generating a Certificate Signing Request..." | |
openssl req -new -key myssl.key -out myssl.csr | |
echo "Removing passphrase from key (for nginx)..." | |
cp myssl.key myssl.key.org | |
openssl rsa -in myssl.key.org -out myssl.key |
JavaScript engines such as Google’s V8 (Chrome, Node) are specifically designed for the fast execution of large JavaScript applications. As you develop, if you care about memory usage and performance, you should be aware of some of what’s going on in your user’s browser’s JavaScript engine behind the scenes.
Continue reading Writing Fast, Memory-Efficient JavaScript, great general overview of a Google employee