Skip to content

Instantly share code, notes, and snippets.

View traumverloren's full-sized avatar

Stephanie traumverloren

View GitHub Profile
@traumverloren
traumverloren / curl-calls.md
Last active September 10, 2020 16:31
How to curl in a Rails API

How to Use cURL to Test Rails controller actions:

-X [action]:
  • Allows you to specify an HTTP action such as GET, POST, PUT or DELETE.

  • Example:
    curl -X DELETE 'http://accounting.dev/v1/refunds/1'

-d [parameter]:

import/export: tbd

object destructuring: tbd

const/let/var:

const/let are block scoped (meaning anywhere we have an opening and closing curly brace we're creating a new scope).

It's generally agreed upon that block scope is a better paradigm than function scope which is why organizations like Mozilla have been primarily using let internally for years. Now that brings us to const. Everything let has, const also has. The only difference is that when you create a variable with const, that variable can't be re-assigned a new reference. Notice I didn't say that variable is immutable.

@traumverloren
traumverloren / 0_reuse_code.js
Created July 4, 2016 12:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@traumverloren
traumverloren / create_indexes.md
Created August 11, 2016 14:24
create mongoid indexes

$ rake db:mongoid:create_indexes or you can do it at compose.io too...

@traumverloren
traumverloren / rails-notes.md
Last active April 29, 2020 12:13
Rails notes

Setup ruby on rails:

https://gorails.com/setup/osx/10.15-catalina

Running Postgresql

To migrate existing data from a previous major version of PostgreSQL run: brew postgresql-upgrade-database

To have launchd start postgresql now and restart at login: brew services start postgresql

@traumverloren
traumverloren / git-tips.md
Last active January 3, 2019 14:12
Git tips

To rename a branch:

git branch -m NEW_NAME

Or, if you are on a different branch:

git branch -m old-name new-name

Wanna delete the old-name remote branch and push the new-name local branch?
@traumverloren
traumverloren / pi_headless_setup.md
Last active December 9, 2016 02:24
Pi Headless Setup

Console Cable Setup:

  • The red lead should be connected to 5V if you want to power via the cable, see below for details
  • The black lead to GND (3rd pin down)
  • The white lead to TXD on the Pi (4th pin down)
  • The green lead to RXD on the pI (5th pin down)

schema

How to setup Pi to wireless using the console cable (headless):

@traumverloren
traumverloren / browser-sync.md
Created December 26, 2016 14:50
using browser-sync

Serve and watch for changes in a directory.

$ browser-sync start --directory --server --directory --files

@traumverloren
traumverloren / kodi_boot.md
Created January 23, 2017 18:06
how to unable kodi on boot on rpi

$ cd /etc/default

$ sudo vi kodi

edit ``ENABLED=1back toENABLED=0`

@traumverloren
traumverloren / EADDRINUSE.md
Last active May 8, 2017 07:53
port in use error resolution

What to do if get error: Error: listen EADDRINUSE 0.0.0.0:8080:

  • To find out what is running on a port 8080: $ lsof -i tcp:8080
  • Kill those processes by referencing the PID: $ kill -9 PUT_PID_#_HERE