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
|
||||
category: Rails
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
### About
|
||||
{: .-intro}
|
||||
|
||||
Arel is an SQL abstraction library built into Ruby on Rails.
|
||||
|
||||
* <https://github.com/rails/arel>
|
||||
|
||||
### Tables
|
||||
|
||||
```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))
|
||||
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
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
### About
|
||||
{: .-intro}
|
||||
|
||||
[Devise](https://github.com/plataformatec/devise) is a flexible authentication
|
||||
gem.
|
||||
|
||||
Installation
|
||||
------------
|
||||
- <https://github.com/plataformatec/devise>
|
||||
|
||||
### Installation
|
||||
|
||||
Rails 3: Add the following to your Gemfile
|
||||
|
||||
|
@ -27,8 +32,7 @@ Generate devise for your model
|
|||
|
||||
$ rails generate devise:views
|
||||
|
||||
Helpers
|
||||
-------
|
||||
### Helpers
|
||||
|
||||
user_signed_in?
|
||||
current_user
|
||||
|
@ -38,8 +42,7 @@ Helpers
|
|||
edit_user_registration_path (Edit registration)
|
||||
new_user_registration_path (Register new user)
|
||||
|
||||
Controller stuff
|
||||
----------------
|
||||
### Controller stuff
|
||||
|
||||
before_filter :authenticate_user!
|
||||
|
||||
|
@ -123,8 +126,11 @@ Routing
|
|||
Test helpers
|
||||
------------
|
||||
|
||||
### Test helpers
|
||||
|
||||
include Devise::TestHelpers
|
||||
https://github.com/plataformatec/devise/blob/1094ba65aac1d37713f2cba71f9edad76b5ca274/lib/devise/test_helpers.rb
|
||||
|
||||
sign_in @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
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
title: Git tricks
|
||||
category: Git
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
## Refs
|
||||
### Refs
|
||||
|
||||
HEAD^ # 1 commit before head
|
||||
HEAD^^ # 2 commits before head
|
||||
HEAD~5 # 5 commits before head
|
||||
|
||||
## Branches
|
||||
### Branches
|
||||
|
||||
# create a new branch
|
||||
git checkout -b $branchname
|
||||
|
@ -31,7 +32,7 @@ category: Git
|
|||
# go back to previous branch
|
||||
git checkout -
|
||||
|
||||
## Collaboration
|
||||
### Collaboration
|
||||
|
||||
# Rebase your changes on top of the remote master
|
||||
git pull --rebase upstream master
|
||||
|
@ -43,6 +44,8 @@ category: Git
|
|||
Submodules
|
||||
----------
|
||||
|
||||
### Submodules
|
||||
|
||||
# Import .gitmodules
|
||||
git submodule init
|
||||
|
||||
|
@ -70,6 +73,8 @@ Diff
|
|||
Log options
|
||||
-----------
|
||||
|
||||
### Options
|
||||
|
||||
--oneline
|
||||
e11e9f9 Commit message here
|
||||
|
||||
|
@ -131,13 +136,13 @@ Misc
|
|||
|
||||
git bisect reset # abort
|
||||
|
||||
## Searching
|
||||
### Searching
|
||||
|
||||
git log --grep="fixes things" # search in commit messages
|
||||
git log -S"window.alert" # search in code
|
||||
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
|
||||
|
||||
|
|
5
gulp.md
5
gulp.md
|
@ -1,8 +1,13 @@
|
|||
---
|
||||
title: Gulp
|
||||
category: JavaScript libraries
|
||||
layout: 2017/sheet
|
||||
tags: [Archived]
|
||||
archived: The information on this sheet may possibly be outdated.
|
||||
---
|
||||
|
||||
### Available plugins
|
||||
|
||||
* gulp-ruby-sass
|
||||
* gulp-autoprefixer
|
||||
* gulp-minify-css
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: Mocha.js TDD interface
|
||||
category: JavaScript libraries
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
### TDD
|
||||
|
|
10
nodejs.md
10
nodejs.md
|
@ -1,15 +1,9 @@
|
|||
---
|
||||
title: Node.js API
|
||||
category: Node.js
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
### About
|
||||
{: .-intro}
|
||||
|
||||
- <https://nodejs.org>
|
||||
|
||||
### Globals
|
||||
## Globals
|
||||
|
||||
__filename
|
||||
__dirname
|
||||
|
@ -27,7 +21,7 @@ layout: 2017/sheet
|
|||
}
|
||||
});
|
||||
|
||||
### Snippets
|
||||
## Snippets
|
||||
|
||||
info = require('../package.json')
|
||||
info.version
|
||||
|
|
10
nopt.md
10
nopt.md
|
@ -1,8 +1,16 @@
|
|||
---
|
||||
title: Nopt
|
||||
category: JavaScript libraries
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
### About
|
||||
{: .-intro}
|
||||
|
||||
- <https://www.npmjs.org/package/nopt>
|
||||
|
||||
### Example
|
||||
|
||||
```js
|
||||
var args = require('nopt')({
|
||||
foo: [String, null],
|
||||
|
@ -46,5 +54,3 @@ if (args.version) {
|
|||
process.exit(0);
|
||||
}
|
||||
```
|
||||
|
||||
https://www.npmjs.org/package/nopt
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
title: PostgreSQL
|
||||
category: Databases
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
Replace anything within `<placeholder>` accordingly
|
||||
|
||||
### Console
|
||||
|
||||
$ psql #logs in to default database & default user
|
||||
$ sudo -u <rolename:postgres> psql #logs in with a particular user
|
||||
|
||||
Replace anything within `<placeholder>` accordingly
|
||||
|
||||
### Commands
|
||||
|
||||
* Show roles: `\du`
|
||||
|
|
Loading…
Reference in New Issue