View polymorphic_belongs_to_finder.rb
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
# Finds all column that reference a certain model name via a polymorphic association. | |
# This is helpful when renaming a table, because if you don't update the model names | |
# in these polymorphic belongs_to associations they will break. | |
class PolymorphicBelongsToFinder | |
POLYMORPHIC_COLUMN_MATCH = /_type\Z/.freeze | |
def initialize(old_model_name) | |
@old_model_name = old_model_name | |
end |
View AWS_Single_LetsEncrypt.yaml
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
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too. | |
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready! | |
Resources: | |
sslSecurityGroupIngress: | |
Type: AWS::EC2::SecurityGroupIngress | |
Properties: | |
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]} | |
IpProtocol: tcp | |
ToPort: 443 |
View dmesg-grep-iwl.output
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
[ 2.280067] iwlwifi 0000:02:00.0: enabling device (0000 -> 0002) | |
[ 2.280492] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-24.ucode failed with error -2 | |
[ 2.280655] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7265D-23.ucode failed with error -2 | |
[ 2.284498] iwlwifi 0000:02:00.0: loaded firmware version 22.361476.0 op_mode iwlmvm | |
[ 2.334381] iwlwifi 0000:02:00.0: Detected Intel(R) Dual Band Wireless AC 7265, REV=0x210 | |
[ 2.336473] iwlwifi 0000:02:00.0: L1 Enabled - LTR Disabled | |
[ 2.336680] iwlwifi 0000:02:00.0: L1 Enabled - LTR Disabled | |
[ 2.403059] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs' | |
[ 2.419105] iwlwifi 0000:02:00.0 wlp2s0: renamed from wlan0 | |
[ 3.905727] iwlwifi 0000:02:00.0: L1 Enabled - LTR Disabled |
View couchdb 2.0 install
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
# Tried on Ubuntu 16.04 Desktop | |
# Refer to: http://couchdb.apache.org/release-candidate/2.0/ | |
# (1) Install npm and nodejs | |
# Run this command and if it says “install” in the right column - “node” is on your system: | |
pkg --get-selections | grep node | |
# To remove eventual old node package, run: | |
apt-get remove --purge node |
View user.rb
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
class User < CouchRest::Model::Base | |
self.database = server.database('_users') | |
def self.model_type_value() 'user' end | |
property :name | |
property :password | |
property :roles | |
property :_id | |
before_save :generate_id, :assign_admin_role |
View job_role.html.slim
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
#vue-job-requirements-app data-job-requirements=job_requirements_json(@job_role.job_requirements) | |
.form-group v-for="req in requirements" | |
input type="hidden" name="job_role[job_requirements_attributes][{{ $index }}][id]" value="{{ req.id }}" | |
input type="hidden" name="job_role[job_requirements_attributes][{{ $index }}][_destroy]" value="{{ req._destroy }}" | |
.input-group v-if="req._destroy != '1'" transition="fade-out" | |
input.form-control type="text" name="job_role[job_requirements_attributes][{{ $index }}][description]" value="{{ req.description }}" | |
.input-group-addon v-on:click="removeRequirement($index)" | |
i.fa.fa-times.text-danger | |
button.btn.btn-success.btn-xs type="button" v-on:click="addRequirement()" | |
i.fa.fa-plus |
View elasticsearch-_all-test.sh
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
# elasticsearch: Version: 2.3.3, Build: 218bdf1/2016-05-17T15:40:04Z, JVM: 1.8.0_92 | |
# Arch Linux | |
# Kernel version 4.4.3-1-custom | |
# Setup a basic index using an edgengram filter | |
curl -XPUT "http://localhost:9200/test_index?pretty=true" -d' | |
{ | |
"settings": { | |
"analysis": { | |
"filter": { |
View middleware-example.rb
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
class Talk | |
def call(env) | |
"Can I talk to #{env[:name]}!" | |
end | |
end | |
class Shout | |
def initialize(app) | |
@app = app | |
end |
View Gemfile
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
source 'https://rubygems.org' | |
gem 'rack' | |
gem 'mail' | |
gem 'puma' |
View add_netid_to_prod_center_accounts
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 | |
script_name = File.basename(__FILE__) | |
file_path = ARGV[0] | |
abort "No input CSV file provided. Example: #{script_name} ./prod_center_accounts.csv" if file_path.nil? | |
abort 'File must have a .csv extension' unless file_path =~ /\.csv\Z/ | |
new_file_path = file_path.gsub(/\.csv\Z/, '_with_netids.csv') |
NewerOlder