Skip to content

Instantly share code, notes, and snippets.

View jprpich's full-sized avatar
🎧
Focusing

Joshua jprpich

🎧
Focusing
View GitHub Profile
@alexpchin
alexpchin / restful_routes.md
Last active July 2, 2024 19:01
7 Restful Routes
URL HTTP Verb Action
/photos/ GET index
/photos/new GET new
/photos POST create
/photos/:id GET show
/photos/:id/edit GET edit
/photos/:id PATCH/PUT update
/photos/:id DELETE destroy
@arjunvenkat
arjunvenkat / gist:1115bc41bf395a162084
Last active January 12, 2024 05:04
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@pooot
pooot / uppy-vue-example
Created January 2, 2018 15:54
Very basic vuejs usage of uppy
<template>
<div :id="uppyId">
<div class="ThumbnailContainer" v-if="collection === 'thumbnail'">
<button id="open-thumbnail-modal" class="button">Select file</button>
</div>
<div class="DashboardContainer" v-else></div>
</div>
</template>

Para hacer algunos ejemplos de herencia, métodos y atributos de clase vamos a modelar un sistema de nómina para una compañía.

Empezamos con una clase Employee de la cual van a extender otras clases:

class Employee
  attr_reader :name, :email, :salary
  
  def initialize(attrs)
    @name = attrs[:name]
var findPairs = function(nums, k) {
if (k < 0) return 0
if (k === 0) {
return handleZeroCase(nums)
} else {
return handleGeneralCase(nums, k)
}
};
function handleZeroCase(nums) {