Skip to content

Instantly share code, notes, and snippets.

@stevenchanin
stevenchanin / gist:d6576dd4f8cdd99b2c1671bda2478048
Created March 24, 2023 22:14
Actions not firing on dynamically added content
Hitting a problem that actions aren't firing from markup dynamically added inside a controller with `insertAdjacentHTML`. Wondering if anyone has any suggestions?
Details:
We have a controller that lets the user edit the heights of air conditioners on a roof (its for a solar panel app). For each air conditioner, we have an "air conditioner div" that has has a target ("heightContainer") and an input with an action ("input->heights-form#updateHeight").
The air conditioner div looks like:
```
.form-group.col-6{ data: { layout_editor__air_conditioner_heights_form_target: "heightContainer", uuid: ac.uuid }}
%div{ class: class_names('field_with_errors': ac.height.blank?), data: { identifier: 'fieldWrapper' } }
@stevenchanin
stevenchanin / Modify Event
Created June 19, 2020 18:28
OpenLayers - Find point on polygon near mouse click
this.modifyInteraction = new Modify({
// source: this.vectorSource, // all features in vector source
features: this.selectInteraction.getFeatures(), // only selected features
condition: (event) => {
// clear out all selectedVertex properties on all features
this.vectorLayer.getSource().forEachFeature((feature) => {
feature.set("selectedVertex", undefined);
});
@stevenchanin
stevenchanin / shell transcript.md
Last active February 24, 2017 00:12
Trying to do a berks vendor
steven@ubuntu:~/projects/rails-server-template$ berks vendor
W, [2017-02-23T15:50:00.037000 #1151]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-23T15:50:00.037197 #1151]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-23T15:50:00.037330 #1151]  WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-23T15:50:00.037456 #1151]  WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Att
require 'capistrano-db-tasks'
# config valid only for current version of Capistrano
lock '3.7.1'
# Change these
server 'myproject.com', port: 54321, roles: [:web, :app, :db], primary: true
set :repo_url, 'git@bitbucket.org:steven_chanin/myproject.git'
set :application, 'myproject'
@stevenchanin
stevenchanin / terminal window
Created June 25, 2015 19:56
How to Sane Output
server | info: POST /api/v1/users
client | POST /api/v1/users 400 77.773 ms - 686
@stevenchanin
stevenchanin / sane_up_output.txt
Created June 15, 2015 18:30
Errors from sane up
server |
server | info: Starting app...
server |
client | version: 0.2.3
client |
client | A new version of ember-cli is available (0.2.7). To install it, type ember update.
client | Could not find watchman, falling back to NodeWatcher for file system events.
client | Visit http://www.ember-cli.com/#watchman for more info.
server | Code did not pass lint rules
server | /home/steven/Projects/how-to-sane/server/api/controllers/AlbumController.js
@stevenchanin
stevenchanin / gist:00cc81a8d308b13c52ca
Last active August 29, 2015 14:23
NVM / NodeJS / NPM / SANE setup on Ubuntu

Initial

Download and setup 14.04 LTS 64 bit

NOTE: Mongo doesn't seem to work with 32 bit

Update all software using the Software Updater (click on the top left icon and type update, then click on the program). This will require a restart.

Update all your package definitions

sudo apt-get update
#javascripts/models/cleints.js.coffee
App.Client = DS.Model.extend
name: DS.attr('string')
active: DS.attr('boolean')
owner: DS.belongsTo('user')
contracts: DS.hasMany('contract')
### Router.js.coffee
App.Router.reopen
rootURL: '/'
location: 'auto'
App.Router.map ->
@resource 'users', ->
@resource 'user', path: '/:id', ->
@route 'edit'
@stevenchanin
stevenchanin / digitalocean.md
Last active December 20, 2021 17:18 — forked from JamesDullaghan/digitalocean.md
Setup instructions for Digital Ocean VPS using Ubuntu and Rails 3.2 #digitalocean #vps #setup

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create Droplet

Create droplet of your liking (ubuntu 12.04 x32) Use an xx.04 LTS version

Setup DNS

On Digital Ocean, create a DNS entry for your server (xyz.com)

Make sure it has NS records that use digital oceans nameservers