In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream pet_project { | |
server localhost:3000; | |
} | |
server { | |
listen 80; | |
server_name frontend; | |
location /demo/pet-project { | |
alias /opt/demo/pet-project/public/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait MetaClass | |
{ | |
protected $__classMethods = array(); | |
static protected $__staticMethods = array(); | |
public function __call($name, $args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example of a state monad in use. This is adapted from an example on | |
* the Haskell Wiki: | |
* http://www.haskell.org/haskellwiki/State_Monad#Complete_and_Concrete_Example_1 | |
*/ | |
require(['state', 'qunit'], function(state, qunit) { | |
/* | |
* playGame() is a recursive function that given an array of moves | |
* defines an algorithm for constructing a final game score. Along |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########## Variables | |
dir=~/dotfiles # dotfiles directory | |
olddir=~/dotfiles_old # old dotfiles backup directory | |
files=".bashrc .vimrc .vim" # list of files/folders to symlink in homedir | |
########## | |
# create dotfiles_old in homedir | |
echo "Creating $olddir for backup of any existing dotfiles in ~" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pygmentize' # gem install pygmentize | |
require 'selenium-webdriver' # gem install selenium-webdriver | |
exit unless code_path = ARGV.shift | |
file_path = File.absolute_path 'code.html' | |
image_path = File.absolute_path 'code_image.png' | |
code = Pygmentize.process File.read(code_path), :ruby | |
html = <<-EOT |
X1C6 Type: 20KG*
Bionic works out of the box on the new 2018 X1 Carbon. The X1C6 is a beautiful laptop, and Bionic is the best Ubuntu yet. Users of all levels of experties/experiences are recommended to try this combination. The purpose of this documentation is to improve the user's experience.
Following changes are required by the DSDT patch:
- Turn off Secure Boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://global.americanexpress.com/offers/eligible | |
function main() { | |
bs = Array.from(document.getElementsByClassName('offer-cta')).filter(button => button.getAttribute("title") == "Add to Card"); | |
if (bs.length > 0) { | |
b = bs.shift(); | |
console.log(b.getAttribute('title')); | |
b.click(); | |
} |
OlderNewer