This commit is contained in:
Rico Sta. Cruz 2015-12-20 05:35:19 +08:00
parent f558ef9401
commit 60a1d7593f
3 changed files with 250 additions and 0 deletions

View File

@ -12,3 +12,83 @@ title: CircleCI
* __deployment__: deploying your code to your web servers
See: <https://circleci.com/docs/configuration>
## Sample
```yml
## Customize the test machine
machine:
timezone:
America/Los_Angeles # Set the timezone
# Version of ruby to use
ruby:
version:
1.8.7-p358-falcon-perf
# Override /etc/hosts
hosts:
circlehost: 127.0.0.1
dev.mycompany.com: 127.0.0.1
# Add some environment variables
environment:
CIRCLE_ENV: test
DATABASE_URL: postgres://ubuntu:@127.0.0.1:5432/circle_test
## Customize checkout
checkout:
post:
- git submodule sync
- git submodule update --init # use submodules
## Customize dependencies
dependencies:
pre:
- npm install coffeescript # install from a different package manager
- gem uninstall bundler # use a custom version of bundler
- gem install bundler --pre
override:
- bundle install: # note ':' here
timeout: 180 # fail if command has no output for 3 minutes
# we automatically cache and restore many dependencies between
# builds. If you need to, you can add custom paths to cache:
cache_directories:
- "custom_1" # relative to the build directory
- "~/custom_2" # relative to the user's home directory
## Customize database setup
database:
override:
# replace CircleCI's generated database.yml
- cp config/database.yml.ci config/database.yml
- bundle exec rake db:create db:schema:load
## Customize test commands
test:
override:
- phpunit test/unit-tests # use PHPunit for testing
post:
- bundle exec rake jasmine:ci: # add an extra test type
environment:
RAILS_ENV: test
RACK_ENV: test
## Customize deployment commands
deployment:
staging:
branch: master
heroku:
appname: foo-bar-123
## Custom notifications
notify:
webhooks:
# A list of hashes representing hooks. Only the url field is supported.
- url: https://someurl.com/hooks/circle
```
See: <https://circleci.com/docs/config-sample>

19
perl-pie.md Normal file
View File

@ -0,0 +1,19 @@
---
title: Perl-pie
category: Development
---
### Search and replace
```sh
perl -p -i -e 's/hello/hola/g' *.txt
```
### Back-referencing
Use `\1` et al.
```sh
# '@include align-items(center);' => 'align-items: center;'
perl -p -i -e "s/\@include (align-items)\((.*)\);/\1: \2;/g"
```

151
riot.md Normal file
View File

@ -0,0 +1,151 @@
---
title: Riot.js
category: JavaScript libraries
---
## Tags
```js
/* tag-name.tag */
<tag-name>
<div>
hello {name}
</div>
this.name = opts.name
</tag-name>
```
```html
<!-- in html -->
<tag-name>
<script>riot.mount('*')</script>
<script>riot.mount('tag-name')</script>
<script>riot.mount('tag-name', { title: 'my app', ... })</script>
```
## Expressions
```
{value}
{value || 'its a js expression'}
<input checked={null}> /* null values ignore the tag */
<p class={ selected: true }>
```
### Loops
```
<li each={movies}>{title}</li>
```
### Conditional
```
<div if={error}>
<div show={error}> /* show using display: '' */
<div hide={error}> /* hide using display: none */
```
### Events
```js
<button onclick={go}>
this.go = function (e) { ... }
```
## API
```js
this.update()
this.update({ data: 'hi' }
this.unmount()
this.unmount(true) // keep parent tag
riot.update() // update all
```
## Nesting
```
<my-tag>
<child></child>
var child = this.tags.child
</my-tag>
```
### Names
```
<my-tag>
<child name='xyz'></child>
var child = this.tags.xyz
</my-tag>
```
## Nested HTML
```js
<yield/>
```
### Yield to/from
```js
<post>
<yield to='title'>Hello</yield>
<yield to='body'>Hey there world</yield>
</post>
```
```js
<post>
<yield from='title'/>
<yield from='body'/>
</post>
```
## Router
```js
riot.route('customers/*/edit', (id) => {
})
riot.route('customers/234/edit')
riot.route.start()
riot.route.start(true) // exec the current url
```
## Lifecycle
```js
this.on('before-mount', function() {
// before the tag is mounted
})
this.on('mount', function() {
// right after the tag is mounted on the page
})
this.on('update', function() {
// allows recalculation of context data before the update
})
this.on('updated', function() {
// right after the tag template is updated
})
this.on('before-unmount', function() {
// before the tag is removed
})
this.on('unmount', function() {
// when the tag is removed from the page
})
// curious about all events ?
this.on('all', function(eventName) {
console.info(eventName)
})
```