Skip to content

Instantly share code, notes, and snippets.

@cheerfulstoic
cheerfulstoic / gist:3142ed2e15ad08ef6631
Last active March 4, 2019 12:56
Script for "Neo4j.rb Screencast #1 - Create a Neo4j Rails Application"

Welcome to the first episode in a series of short screencasts for the Ruby neo4j gem. Each episode will describe a different aspect of the gem. In this first episode, we will start by discussing how to set up a new Ruby on Rails app using Neo4j. The neo4j gem is not Rails specific so you can use other frameworks like Sinatra or Lotus, but because of the popularity of Ruby on Rails we will be using it for this screencast series.

In this series we’re going to create an application to host digital assets which we’ll call "asset_portal". To create your Rails app you can run a rails new command as usual. To use Neo4j instead of ActiveRecord you can give arguments which will set up a new Rails app using Neo4j models.

rails new asset_portal -m http://neo4jrb.io/neo4j/neo4j.rb -O

The dash-m argument runs a script from the neo4j gem project and the dash-capital-O argument says to exclude ActiveRecord. There aren’t any restrictions on using Neo4j with other ORMs like ActiveRecord, but you will need to conf

@Kartones
Kartones / postgres-cheatsheet.md
Last active May 3, 2024 20:51
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@anotheruiguy
anotheruiguy / web-fonts-asset-pipeline.md
Last active May 24, 2023 22:08
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@aponxi
aponxi / sql-mongo_comparison.md
Last active February 21, 2024 11:56
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@jessieay
jessieay / ActiveRecord Cheat Sheet v1
Created July 17, 2012 19:55
Active Record cheat sheet with examples of queries I've needed most so far
ActiveRecord cheat sheet / EXAMPLES
INSTALL
=======
$ gem install activerecord
in GEMFILE: gem ‘activerecord’
REQUIRE
=======
require ‘active_record’