Skip to content

Instantly share code, notes, and snippets.

View codespore's full-sized avatar
🔍
Looking for my next mission

Adrian Teh codespore

🔍
Looking for my next mission
View GitHub Profile
@codespore
codespore / gist:7014ebf319db3ded52bad62185f7de56
Created August 22, 2016 00:48 — forked from arjunvenkat/gist:1115bc41bf395a162084
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.

@codespore
codespore / README-Template.md
Created July 10, 2017 19:22 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@codespore
codespore / caliber.txt
Created July 24, 2018 16:41
Credentials to setup a Caliber community in FSC
{
"name": "Test Community - CaliberSandbox Windwalker Ranch",
"accountingPlatform": "Caliber",
"platformConnection": null,
"companyKey": "https://asp.calibersoftware.com/capi2_APISandbox/api/v2/",
"communityKey": "2",
"lastSync": "0001-01-01T00:00:00",
"apiCode": "capiDocs",
"apiLoginName": "csapi",
"apiLoginPassword": "cspwd$!",
@codespore
codespore / gist:cac304a22cb91cb0319dca9370a785f0
Created August 30, 2018 19:25
How to get payment flags from TOPS owner account
client = Tops::Client.new("TOPS community api key","TOPS community key")
tops_owner = client.owner("TOPS owner key")
tops_owner.Metadata.HoldCollection
tops_owner.Metadata.HoldPayment
<!DOCTYPE html>
<html>
<head>
<title>Helloworld</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
@codespore
codespore / hello_world.rb
Created July 9, 2019 14:59
Simple hello world page
# app/controllers/home_controller.rb
class HomeController < ApplicationController
end
# app/views/home/index.html.erb
<h1>Hello World</h1>
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip on top
</button>
const { environment } = require('@rails/webpacker')
const webpack = require('webpack')
environment.plugins.append('Provide',
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
Popper: ['popper.js', 'default']
})
)
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
import 'bootstrap'
document.addEventListener("turbolinks:load", () => {
$('[data-toggle="tooltip"]').tooltip()
})
# app/javascript/packs/stylesheets/application.scss
@import "~bootstrap/scss/bootstrap"; // never forget the semicolon at the end
@import "./_custom";
# app/javascript/packs/stylesheets/_custom.scss
h1 {
color: red;
}
# config/routes.rb
Rails.application.routes.draw do
get '/calendar', to: 'calendar#index'
root to: 'home#index'
end
# app/javascript/packs/calendar.js
alert('Calendar loaded')
# app/controllers/calendar_controller.rb