Skip to content

Instantly share code, notes, and snippets.

@hubertshon
hubertshon / TIL.md
Last active November 24, 2020 21:16

2020.05.19 - Today I learned how initalize directories and push files to Github.
2020.05.20 - Today I learned how to condense the code in a Class instance with attribute readers, attribute writers, and attribute accessors.
2020.05.20 - Today I learned to simplify hash notation with JSON style.
2020.05.21 - Today I learned how to setup default values in the initialize method with the or operand.
2020.05.21 - I also learned that a block variable can be used in place to iterate through an array.
2020.05.21 - TIL that to pass methods results to other methods, the proper syntax is method_a(argument_for_result)
2020.05.22 - TIL how to parse data from APIs with Ruby
2020.05.25 - TIL how to setup a simple web response with Rails. Web Request, API Route, API Controller, API View, Web Response
2020.05.26 - TIL how to set up a model in Rails
2020.05.26 - TIL that the && operator will not move on if the first statement is false

@Envek
Envek / pg_interval_support_4_1.rb
Last active December 18, 2023 14:41
Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails from 4.1 to 6.0
# Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails 4.1.
# Based on https://gist.github.com/clarkdave/6529610
require 'active_support/duration'
# add a native DB type of :interval
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:interval] = { name: 'interval' }
# add the interval type to the simplified_type list. because this method is a case statement
# we can't inject anything into it, so we create an alias around it so calls to it will call
@cobyism
cobyism / gh-pages-deploy.md
Last active June 26, 2024 04:31
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).