サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
Nintendo Direct
devhints.io
This is a quick reference to getting started with Bash scripting. Learn bash in y minutes (learnxinyminutes.com) Bash Guide (mywiki.wooledge.org) Bash Hackers Wiki (wiki.bash-hackers.org)
{ hero { name height } } ↓ { hero: { name: "Luke Skywalker", height: 1.74 } } { friends { name } } ↓ { friends: [ { name: "Luke Skywalker" }, { name: "Han Solo" }, { name: "R2D2" } ] } GraphQL queries look the same for both single items or lists of items.
npm install --save-dev jest babel-jest /* Add to package.json */ "scripts": { "test": "jest" } # Run your tests npm test -- --watch See: Getting started
Basics Introduction This is a quick reference to Sass stylesheets. Sass documentation (sass-lang.com) Variables $red: #833; body { color: $red; } Nesting .markdown-body { a { color: blue; &:hover { color: red; } } } to properties text: { align: center; // like text-align: center transform: uppercase; // like text-transform: uppercase } Comments /* Block comments */ // Line comments Mixins @mixin h
/** * This is a function. * * @param {string} n - A string param * @param {string} [o] - A optional string param * @param {string} [d=DefaultValue] - A optional string param * @return {string} A good string * * @example * * foo('hello') */ function foo(n, o, d) { return n } See: https://jsdoc.app/index.html
Installing # MacOS + Homebrew $ brew install tig --HEAD # Ubuntu $ sudo apt install tig Invocation Command Description
Creating a store import { createStore } from 'redux' // Reducer function counter (state = { value: 0 }, action) { switch (action.type) { case 'INCREMENT': return { value: state.value + 1 } case 'DECREMENT': return { value: state.value - 1 } default: return state } } let store = createStore(counter) // Optional - you can pass `initialState` as a second arg let store = createStore(counter, { value:
# hello.exs defmodule Greeter do def greet(name) do message = "Hello, " <> name <> "!" IO.puts message end end Greeter.greet("world") elixir hello.exs # Hello, world!
# Install the gems gem install jekyll bundler # Create a new site at `./myblog` jekyll new myblog cd myblog # Optional: if you're targeting github-pages, # use this Gemfile instead. cat > Gemfile <<-END source 'https://rubygems.org' gem 'github-pages', group: :jekyll_plugins END bundle exec jekyll serve See: Jekyll quickstart See: github/pages-gem ./ ├── _config.yml │ ├── _data/ │ └── ... │ ├── _d
Getting started Introduction A tour of Go (tour.golang.org) Go repl (repl.it) Golang wiki (github.com) Hello world hello.go package main import "fmt" func main() { message := greetMe("world") fmt.Println(message) } func greetMe(name string) string { return "Hello, " + name + "!" } $ go build Or try it out in the Go repl, or A Tour of Go. Variables Variable declaration var msg string var msg = "Hel
About Arel is an SQL abstraction library built into Ruby on Rails. https://github.com/rails/arel Tables users = Arel::Table.new(:users) users = User.arel_table # ActiveRecord model Fields users[:name] users[:id] where (restriction) users.where(users[:name].eq('amy')) # SELECT * FROM users WHERE users.name = 'amy' select (projection) users.project(users[:id]) # SELECT users.id FROM users join basic
Start hacking let name = "John" echo "Hello, " . name You can either put this in a script (script.vim) and run it (:source script.vim), or you can type the commands individually in normal mode as :let and :echo. Learn by example function! SuperTab() let l:part = strpart(getline('.'),col('.')-2,1) if (l:part =~ '^\W\?$') return "\<Tab>" else return "\<C-n>" endif endfunction imap <Tab> <C-R>=SuperT
A quick overview of new JavaScript features in ES2015, ES2016, ES2017, ES2018 and beyond. Block scoping Let function fn () { let x = 0 if (true) { let x = 1 // only inside this `if` } } Const const a = 1 let is the new var. Constants work just like let, but can’t be reassigned. See: Let and const Backtick strings Interpolation const message = `Hello ${name}` Multiline strings const str = ` hello w
attach_file 'Image', '/path/to/image.jpg' fill_in 'First Name', with: 'John' check 'A checkbox' uncheck 'A checkbox' choose 'A radio button' select 'Option', from: 'Select box' unselect
Getting started Introduction Enzyme lets you write unit tests for React components. This guide covers Enzyme 3.x. Enzyme website (enzymejs.github.io) Mounting import {shallow, mount} from 'enzyme' wrap = shallow(<MyComponent />) wrap = mount(<MyComponent />) Shallow wrapping doesn’t descend down to sub-components. A full mount also mounts sub-components. See: Shallow rendering, Full rendering Debu
Cask commands are used for interacting with graphical applications.
redux-actions Create action creators in flux standard action format. increment = createAction('INCREMENT', amount => amount) increment = createAction('INCREMENT') // same increment(42) === { type: 'INCREMENT', payload: 42 } // Errors are handled for you: err = new Error() increment(err) === { type: 'INCREMENT', payload: err, error: true } redux-actions flux-standard-action A standard for flux acti
//div[contains(concat(' ',normalize-space(@class),' '),' foobar ')] Xpath doesn’t have the “check if part of space-separated list” operator, so this is the workaround (source).
Assert const { assert } = require('chai') assert(val) assert.fail(actual, expected) assert.ok(val) // is truthy assert.equal(actual, expected) // compare with == assert.strictEqual(actual, expected) // compare with === assert.deepEqual(actual, expected) // deep equal check assert.isTrue(val) assert.isFalse(val) assert.isNull(val) assert.isNotNull(val) assert.isUndefined(val) assert.isDefined(val)
Factory Bot is a helper for writing factories for Ruby tests. It was previously known as Factory Girl. For older versions, use FactoryGirl instead of FactoryBot. Factory Bot documentation (rubydoc.info) Getting started (github.com) Source code (github.com) FactoryBot.define do factory :user do first_name { 'John' } last_name { 'Doe' } birthdate { 21.years.ago } admin { false } sequence(:username)
doctype html html head title Slim Examples meta[charset='utf-8'] meta(name="keywords" content="template language") meta name="author" content=author meta property='og:image' content=asset_url('foo.png') meta property='og:image' content=(path_to_user user) meta( property='description' content='this is the song that never ends') meta[charset='utf-8'] meta(name="keywords" content="template language")
import { default as Router, Route } from 'react-router' const routes = ( <Route> <Route path='*' handler={RootView} /> </Route> ) Router.run(routes, Router.HashLocation, (Root) => { React.render(<Root />, document.getElementById('all')) }) const routes = ( <Route handler={Chrome}> <Route path='about' handler={About} /> <Route path='inbox' handler={Inbox} /> <Route path='messages/:id' handler={Mess
Rico's cheatsheets Hey! I'm @rstacruz and this is a modest collection of cheatsheets I've written. devhints.io / bash Bash scripting enzyme Enzyme es6 ES2015+ go Go react React.js sass Sass vim Vim xpath Xpath Recently updated clip Command Line Interface Pages tig Tig tar tar atom Atom grep GNU grep stimulus-reflex StimulusReflex screen Screen factory_bot Factory Bot vimscript Vim scripting vim Vi
Generating Generating $ rails g model User Using models Query methods items = Model .where(first_name: 'Harvey') .where('id = 3') .where('id = ?', 3) .order(:title) .order(title: :desc) .order("title DESC") .reorder(:title) # discards other .order's .rewhere(...) # discards other .where's .limit(2) .offset(1) .uniq See: QueryMethods Advanced query methods items = Model .select(:id) .select([:id, :
<Video fullscreen={true} autoplay={false} /> render () { this.props.fullscreen const { fullscreen, autoplay } = this.props ··· } Use this.props to access properties passed to the component. See: Properties constructor(props) { super(props) this.state = { username: undefined } } this.setState({ username: 'rstacruz' }) render () { this.state.username const { username } = this.state ··· } Use states
このページを最初にブックマークしてみませんか?
『Devhints — TL;DR for developer documentation』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く