Update arel.md (+9 more changes)
This commit is contained in:
parent
db559f8898
commit
5f39cfcbe1
12
arel.md
12
arel.md
|
@ -1,8 +1,16 @@
|
||||||
---
|
---
|
||||||
title: Arel
|
title: Arel
|
||||||
category: Rails
|
category: Rails
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### About
|
||||||
|
{: .-intro}
|
||||||
|
|
||||||
|
Arel is an SQL abstraction library built into Ruby on Rails.
|
||||||
|
|
||||||
|
* <https://github.com/rails/arel>
|
||||||
|
|
||||||
### Tables
|
### Tables
|
||||||
|
|
||||||
```rb
|
```rb
|
||||||
|
@ -123,7 +131,3 @@ all_time = photos_with_credits.count
|
||||||
this_month = photos_with_credits.where(photos[:created_at].gteq(Date.today.beginning_of_month))
|
this_month = photos_with_credits.where(photos[:created_at].gteq(Date.today.beginning_of_month))
|
||||||
recent_photos = photos_with_credits.where(photos[:created_at].gteq(Date.today.beginning_of_month)).limit(5)
|
recent_photos = photos_with_credits.where(photos[:created_at].gteq(Date.today.beginning_of_month)).limit(5)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reference
|
|
||||||
|
|
||||||
* <http://github.com/rails/arel>
|
|
||||||
|
|
20
devise.md
20
devise.md
|
@ -1,12 +1,17 @@
|
||||||
---
|
---
|
||||||
title: Devise
|
title: Devise
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### About
|
||||||
|
{: .-intro}
|
||||||
|
|
||||||
[Devise](https://github.com/plataformatec/devise) is a flexible authentication
|
[Devise](https://github.com/plataformatec/devise) is a flexible authentication
|
||||||
gem.
|
gem.
|
||||||
|
|
||||||
Installation
|
- <https://github.com/plataformatec/devise>
|
||||||
------------
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
Rails 3: Add the following to your Gemfile
|
Rails 3: Add the following to your Gemfile
|
||||||
|
|
||||||
|
@ -27,8 +32,7 @@ Generate devise for your model
|
||||||
|
|
||||||
$ rails generate devise:views
|
$ rails generate devise:views
|
||||||
|
|
||||||
Helpers
|
### Helpers
|
||||||
-------
|
|
||||||
|
|
||||||
user_signed_in?
|
user_signed_in?
|
||||||
current_user
|
current_user
|
||||||
|
@ -38,8 +42,7 @@ Helpers
|
||||||
edit_user_registration_path (Edit registration)
|
edit_user_registration_path (Edit registration)
|
||||||
new_user_registration_path (Register new user)
|
new_user_registration_path (Register new user)
|
||||||
|
|
||||||
Controller stuff
|
### Controller stuff
|
||||||
----------------
|
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
|
@ -123,8 +126,11 @@ Routing
|
||||||
Test helpers
|
Test helpers
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
### Test helpers
|
||||||
|
|
||||||
include Devise::TestHelpers
|
include Devise::TestHelpers
|
||||||
https://github.com/plataformatec/devise/blob/1094ba65aac1d37713f2cba71f9edad76b5ca274/lib/devise/test_helpers.rb
|
|
||||||
|
|
||||||
sign_in @user
|
sign_in @user
|
||||||
sign_out @user
|
sign_out @user
|
||||||
|
|
||||||
|
See: <https://github.com/plataformatec/devise/blob/1094ba65aac1d37713f2cba71f9edad76b5ca274/lib/devise/test_helpers.rb>
|
||||||
|
|
12
flux.md
12
flux.md
|
@ -1,9 +1,19 @@
|
||||||
---
|
---
|
||||||
title: Flux architecture
|
title: Flux architecture
|
||||||
category: React
|
category: React
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
## Architecture
|
## About
|
||||||
|
|
||||||
|
### About
|
||||||
|
{: .-intro}
|
||||||
|
|
||||||
|
Flux is an architecture for building client-side web applications.
|
||||||
|
|
||||||
|
* [In-Depth Overview](https://facebook.github.io/flux/docs/in-depth-overview/) _(facebook.github.io)_
|
||||||
|
|
||||||
|
### Architecture
|
||||||
|
|
||||||
* __Dispatchers__ receive *actions* that get dispatched to its listeners.
|
* __Dispatchers__ receive *actions* that get dispatched to its listeners.
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
---
|
---
|
||||||
title: Git tricks
|
title: Git tricks
|
||||||
category: Git
|
category: Git
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
## Refs
|
### Refs
|
||||||
|
|
||||||
HEAD^ # 1 commit before head
|
HEAD^ # 1 commit before head
|
||||||
HEAD^^ # 2 commits before head
|
HEAD^^ # 2 commits before head
|
||||||
HEAD~5 # 5 commits before head
|
HEAD~5 # 5 commits before head
|
||||||
|
|
||||||
## Branches
|
### Branches
|
||||||
|
|
||||||
# create a new branch
|
# create a new branch
|
||||||
git checkout -b $branchname
|
git checkout -b $branchname
|
||||||
|
@ -31,7 +32,7 @@ category: Git
|
||||||
# go back to previous branch
|
# go back to previous branch
|
||||||
git checkout -
|
git checkout -
|
||||||
|
|
||||||
## Collaboration
|
### Collaboration
|
||||||
|
|
||||||
# Rebase your changes on top of the remote master
|
# Rebase your changes on top of the remote master
|
||||||
git pull --rebase upstream master
|
git pull --rebase upstream master
|
||||||
|
@ -43,6 +44,8 @@ category: Git
|
||||||
Submodules
|
Submodules
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
### Submodules
|
||||||
|
|
||||||
# Import .gitmodules
|
# Import .gitmodules
|
||||||
git submodule init
|
git submodule init
|
||||||
|
|
||||||
|
@ -70,6 +73,8 @@ Diff
|
||||||
Log options
|
Log options
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
--oneline
|
--oneline
|
||||||
e11e9f9 Commit message here
|
e11e9f9 Commit message here
|
||||||
|
|
||||||
|
@ -131,13 +136,13 @@ Misc
|
||||||
|
|
||||||
git bisect reset # abort
|
git bisect reset # abort
|
||||||
|
|
||||||
## Searching
|
### Searching
|
||||||
|
|
||||||
git log --grep="fixes things" # search in commit messages
|
git log --grep="fixes things" # search in commit messages
|
||||||
git log -S"window.alert" # search in code
|
git log -S"window.alert" # search in code
|
||||||
git log -G"foo.*" # search in code (regex)
|
git log -G"foo.*" # search in code (regex)
|
||||||
|
|
||||||
## GPG Signing
|
### GPG signing
|
||||||
|
|
||||||
git config set user.signingkey <GPG KEY ID> # Sets GPG key to use for signing
|
git config set user.signingkey <GPG KEY ID> # Sets GPG key to use for signing
|
||||||
|
|
||||||
|
|
5
gulp.md
5
gulp.md
|
@ -1,8 +1,13 @@
|
||||||
---
|
---
|
||||||
title: Gulp
|
title: Gulp
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
layout: 2017/sheet
|
||||||
|
tags: [Archived]
|
||||||
|
archived: The information on this sheet may possibly be outdated.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Available plugins
|
||||||
|
|
||||||
* gulp-ruby-sass
|
* gulp-ruby-sass
|
||||||
* gulp-autoprefixer
|
* gulp-autoprefixer
|
||||||
* gulp-minify-css
|
* gulp-minify-css
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Mocha.js TDD interface
|
title: Mocha.js TDD interface
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
### TDD
|
### TDD
|
||||||
|
|
10
nodejs.md
10
nodejs.md
|
@ -1,15 +1,9 @@
|
||||||
---
|
---
|
||||||
title: Node.js API
|
title: Node.js API
|
||||||
category: Node.js
|
category: Node.js
|
||||||
layout: 2017/sheet
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### About
|
## Globals
|
||||||
{: .-intro}
|
|
||||||
|
|
||||||
- <https://nodejs.org>
|
|
||||||
|
|
||||||
### Globals
|
|
||||||
|
|
||||||
__filename
|
__filename
|
||||||
__dirname
|
__dirname
|
||||||
|
@ -27,7 +21,7 @@ layout: 2017/sheet
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
### Snippets
|
## Snippets
|
||||||
|
|
||||||
info = require('../package.json')
|
info = require('../package.json')
|
||||||
info.version
|
info.version
|
||||||
|
|
10
nopt.md
10
nopt.md
|
@ -1,8 +1,16 @@
|
||||||
---
|
---
|
||||||
title: Nopt
|
title: Nopt
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### About
|
||||||
|
{: .-intro}
|
||||||
|
|
||||||
|
- <https://www.npmjs.org/package/nopt>
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var args = require('nopt')({
|
var args = require('nopt')({
|
||||||
foo: [String, null],
|
foo: [String, null],
|
||||||
|
@ -46,5 +54,3 @@ if (args.version) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
https://www.npmjs.org/package/nopt
|
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
---
|
---
|
||||||
title: PostgreSQL
|
title: PostgreSQL
|
||||||
category: Databases
|
category: Databases
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
Replace anything within `<placeholder>` accordingly
|
|
||||||
|
|
||||||
### Console
|
### Console
|
||||||
|
|
||||||
$ psql #logs in to default database & default user
|
$ psql #logs in to default database & default user
|
||||||
$ sudo -u <rolename:postgres> psql #logs in with a particular user
|
$ sudo -u <rolename:postgres> psql #logs in with a particular user
|
||||||
|
|
||||||
|
Replace anything within `<placeholder>` accordingly
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
|
|
||||||
* Show roles: `\du`
|
* Show roles: `\du`
|
||||||
|
|
Loading…
Reference in New Issue