Skip to content

Instantly share code, notes, and snippets.

View mwenger1's full-sized avatar

Mike Wenger mwenger1

View GitHub Profile
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 2
},
"objects": [
{
@mwenger1
mwenger1 / new-client-project-checklist.md
Last active October 20, 2023 20:00
NewClientProjectChecklist

Joining a Rails Project Checklist

Getting My Bearings

@mwenger1
mwenger1 / gist:8a5d54749d611e6f09948bdea1b2852f
Last active December 28, 2017 18:58
ReactNativeReference.md

Starting a new project

C-b space => Swaps veritcal/horizontal Search with "/" and "?"

Vim

:b spec/  => recent files in buffer
:buffers => recently opened files
:Unlink => Delete files
:registers; "6p  => print sixth item in clipbard
zzCenter the current line within the window
ztBring the current line to the top of the window
zbBring the current line to the bottom of the window
ctrl+w, T = open pane in a new tab

Bash

wget -r -np -k http://sidekiq.org/ => Download Entire Website
:Ag spec/**/*file*
export RAILS_ENV=test => set env value temporarily
ls | wc -l # count number of lines
grep -e FactoryGirl **/*.rake **/*.rb -l | xargs sed -i "" "s|FactoryGirl|FactoryBot|" # replace words in specific files
@mwenger1
mwenger1 / DatabaseResources.md
Last active February 28, 2017 15:44
Commonly Used SQL/Active Record/Database Snippets

Query Syntax

SELECT now() - query_start as "runtime", usename, datname, waiting, state, query
  FROM  pg_stat_activity
  WHERE now() - query_start > '2 minutes'::interval
 ORDER BY runtime DESC;

Migrations

@mwenger1
mwenger1 / JavascriptReference.md
Last active March 10, 2017 22:28
Commonly Used javascript references

Sandbox

babel-node
.editor

ES6

New Goodies

[
{
"title": "Elixir & Phoenix in Production",
"videoUrl": "https://embedwistia-a.akamaihd.net/deliveries/28fb24ee5c38509d8726d4214e65d1420c6e775c/file.mp4",
"minutes": "18",
"tags": [
"Foundations",
"Testing"
],
"description": "Elixir & Phoenix, so hot right now! On this week’s episode we’ll take a look at some of the great features of both Elixir and Phoenix through the lens of Bamboo, a library for sending emails in Phoenix apps, recently released by thoughtbot...",
@mwenger1
mwenger1 / RubyReference.md
Last active July 14, 2017 17:19
Commonly used ruby snippets

Polymorphic Relationship

  # db/migrate
  Picture
    t.integer :imageable_id
    t.string  :imageable_type
    OR
    t.references :imageable, polymorphic: true, index: true

  # models