Skip to content

Instantly share code, notes, and snippets.

@sealocal
sealocal / oop-private-methods.js
Created July 5, 2018 19:16
Demonstrate private method in JavaScript constructor function.
'use strict'
function Car(make, model, year) {
// public variables
this.make = make;
this.model = model;
this.year = year;
this.breakPedalIsPressed = false;
// private variable
@sealocal
sealocal / yarn.config
Last active May 14, 2021 12:16
Install Yarn and NodeJS on AWS Elastic Beanstalk EC2 Instance with Amazon Linux Ruby Platform, prior to precompiling assets for a Rails app
files:
# If this file is edited, it must be removed from EC2 instance prior to deploy.
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn_install.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
set -xe
@sealocal
sealocal / SassMeister-input-HTML.html
Last active August 29, 2015 14:18
Generated by SassMeister.com.
<html>
<head>
</head>
<div class="col-sm-offset-1 col-sm-3">
<form class="form-horizontal">
<!-- Bootswatch Example Form Input -->
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<div class="input-group">
<div class="input-group-addon">$</div>
@sealocal
sealocal / deleting_a_post_test.rb
Last active August 29, 2015 13:55
Test for Deleting a Record from a Model with Capybara
#Use this line, replacing :id with and integer.
page.driver.submit :delete, "/posts/:id", {}
#You can also use fixtures
page.driver.submit :delete, "/posts/#{posts(:cr).id}", {}
featuren "Deleting a Post" do
scenario "As an author I should not be able to delete posts so that I can give the editor publishing control" do
#Given an author role
sign_in(:author)