A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord| import React, { useState, useEffect, Fragment } from "react"; | |
| const Images = images => { | |
| const imageLinks = images.map(({ link }) => link); | |
| const [imageClickCount, setImageClickCount] = useState({}); | |
| const buildImageClickCount = () => { | |
| const obj = {}; | |
| images.forEach(({ link }) => { |
| # https://vimeo.com/192116528 | |
| require "graphics" | |
| class Clock < Graphics::Simulation | |
| def initialize | |
| @radius = 400 | |
| @margin = 20 | |
| @increment_rate = 0.0009 | |
| @num_lines = 1600 | |
| @line_width = 2 |
| /** | |
| * Using Operator Mono in Atom | |
| * | |
| * 1. Open up Atom Preferences. | |
| * 2. Click the “Open Config Folder” button. | |
| * 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up. | |
| * 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden! | |
| * 5. Tweak away. | |
| * | |
| * Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png): |
This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.
First let's check something.
brew info postgresqlThe top of what gets printed as a result is the most important:
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
| /** | |
| * | |
| * Dinesh | |
| * | |
| * RootedTreeTraversal | |
| * - Preorder Traversal | |
| * - Postorder Traversal | |
| * - Inorder Traversal | |
| * - Levelorder Traversal | |
| * |
| require 'rblineprof' | |
| module Rblineprof | |
| module ConsoleHelpers | |
| include Rblineprof::Helpers | |
| def lineprof_block(options = {}, &block) | |
| profile = lineprof(rblineprof_profiler_regex(options[:lineprofiler])) do | |
| ret = yield | |
| end |
| require "active_record" | |
| namespace :db do | |
| db_config = YAML::load(File.open('config/database.yml')) | |
| db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
| desc "Create the database" | |
| task :create do | |
| ActiveRecord::Base.establish_connection(db_config_admin) |