Skip to content

Instantly share code, notes, and snippets.

function hasValue(value) {
return !!value
|| value === 0
|| value === false
}
/**
* @description
* getSubset returns an object with the same structure as the original object passed in, but contains
* only the specified paths and only if those paths have "value" (truth-y values, 0 or false).
gp1 = KyckPipeline.new(Oriented.graph)
gp2 = KyckPipeline.new(Oriented.graph)
gp.copy_split(
gp1._().out(UserData.relationship_label_for(:plays_for)).filter {|it| it["@class"] == "Roster"}.in(TeamData.relationship_label_for(:rosters)),
gp2._().out(UserData.relationship_label_for(:staff_for)).filter {|it| it["@class"] == "Team"}
).fair_merge
def report_bad_accounts
no_bad = 0
CSV.foreach('play_accounts.csv', headers: true) do |row|
acc = Account.where(email: row['email']).first
puts "Account not found for #{row['email']}" && next unless acc
unless acc.kyck_id.to_s == row['kyck_id']
no_bad += 1
puts "KYCK IDs don't match for #{row['email']}"
puts "Auth KYCK ID=#{acc.kyck_id.to_s} / Play KYCK ID=#{row['kyck_id']}"
end
def update_sb_for_bad_cards(increment=500)
cmd = OrientDB::SQLCommand.new("select count(*) from card")
res = Oriented.graph.command(cmd).execute
count = res.to_a.first["count"]
loop_count = count/increment
start_id = 0
(0..loop_count).each do |num|
end_id = start_id + increment
#!/usr/bin/env ruby
# Pass in the name of the site you wich to create a cert for
domain_name = ARGV[0]
if domain_name == nil
puts "Y U No give me a domain name?"
else
system "openssl genrsa -out #{domain_name}.key 1024"
system "openssl req -new -key #{domain_name}.key -out #{domain_name}.csr -subj '/C=US/ST=NJ/L=Monroe/O=MyCompany/OU=IT/CN=#{domain_name}'"
deploy:
provider: ninefold
auth-token: "PqVXvVMWqHR6XF4UqZFqvoZwEpMlXcO_SkoCl6NPinmJ8KT1uMkl7ws_lihOoAk2iQ5rpfqF-mRRWHozuKp_yA"
app-id: "10906"
edge: true
skip_cleanup: true
before_script:
- psql -c "DROP DATABASE IF EXISTS ninethings_test;" -U postgres
- psql -c 'create database ninethings_test;' -U postgres
def create
@post = Post.new(post_params)
respond_to do |format|
Rails.logger.info "*** format = #{format.inspect}"
if @post.save
format.html { redirect_to root_path }
format.js # Will search for create.js.erb
else
format.html { render root_path }
end
<div class="tabs-content-container" >
<div class="container tabbable">
<div class="section-container kyck-tabs" data-section="auto" data-section-resized="true">
<% build_tabs(@org, @team, @competition, @division).each do |k, t|
next if !t %>
<section class="section tabPane" <%= t[:disabled] || '' %> title="<%= t[:title] %>" href="<%= t[:href] %>" state="<%= t[:state] || '' %>"></section>
<% next unless t[:sublinks] %>
<ul class='sublinks'>
<% t[:sublinks].each do |st| %>
<li class="section tabPane" <%= st[:disabled] || '' %> title="<%= st[:title] %>" href="<%= st[:href] %>" state="<%= st[:state] || '' %>"></li>
def staff_tab(base_url)
sublinks = []
sublinks << {title: 'View All Staff', href: "#{base_url}/staff"}
sublinks << {title: 'Add New Staff', href: "#{base_url}/staff/new"} if current_user.can_manage?(org, [PermissionsSet::MANAGE_STAFF])
{ title: 'Staff', href: "#{base_url}/staff", icon:'icon-home', sublinks: sublinks }
end
def add_missing_answers
answer_count = @check_in.check_in_answers.length
return if answer_count >= 4
answers_to_add = 4 - answer_count
answers_to_add.times do
@check_in.check_in_answers.build
end
end