Skip to content

Instantly share code, notes, and snippets.

var ele = details[i].elements.filter(e => e.name !== null).findIndexPolyfill(e => e.name.includes(query)) == -1;
var cmts = details[i].elements.filter(e => e.cmts !== null).findIndexPolyfill(e => e.cmts.includes(query)) == -1;
if (query && ele){
continue;
}
@ornerymoose
ornerymoose / Component.vue
Last active March 5, 2020 18:15
the <span> element correctly shows the ticket number. Given that ticket_number in data() is pointed at this.ticket_num, shouldn't I be able to console.log(this.ticket_number)? It currently returns undefined.
<template>
<template slot="row-details" slot-scope="row">
<span :ticket_num="row.item.ticket_number"></span>
</template>
</template>
<script>
export default {
name: 'MaintenanceDetailsTable',
props: ['ticket_num'],
@ornerymoose
ornerymoose / controller.cs
Created July 12, 2019 20:17
the below works but isn't very clean.
// initalize resi_vid/hsd/voice and comm_vid/hsd_voice to 0...
// result.summary.products is List<ImpactProduct> Summary.products
foreach (var r in result.summary.products)
{
if (r.customer_class == "Residential" && r.name == "Video")
{
resi_vid = r.customer_count;
import time
print('Hello! What is your name?')
name = input()
print("It's nice to meet you, " + name + "! How old are you?")
age = input()
print("Wow! " + age + "? That's so great. Do you have a favorite color? What is it?")
color = input()
@ornerymoose
ornerymoose / EmployeeController.cs
Last active March 14, 2019 20:25
if I set a breakpoint on this method and go to localhost:1234/api/employee, the breakpoint will be hit. If I try to do localhost:1234/api/employee/SOME_ID it'll 404. What am I overlooking here?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using MyApp.ElasticData;
using MyApp.Models;
namespace MyApp.Controllers
{
def submit(self, form):
""" create SIs """
tickets = []
if form.id == 1:
tts_obj = Tts(
source='Raven',
region='Mountain West',
element='test_element120',
element_type='CMTS',
problem_code='99999'
using Mapia.Core.Importer.Internal.Models;
using System;
using System.Collections.Generic;
namespace Mapia.Core.Models
{
public class Maintenance : BaseImportData
{
public string Id { get; set; }
@ornerymoose
ornerymoose / haversine.rb
Created March 13, 2018 18:01
fiber has 171k rows, customers has 21k rows
require 'csv'
require 'haversine'
fiber = CSV.read("fiber/all_florida_fiber.csv", {headers: true}).first(3)
customers = CSV.read("prospect_customers_geocoded.csv", {headers: true, encoding: 'ISO-8859-1'}).first(3)
hh = Hash.new { |hsh,key| hsh[key] = [] }
#for each customer, loop through all the fiber coords
customers.each do |customer|
@ornerymoose
ornerymoose / outage.rb
Created February 8, 2018 21:11
trying to detect when the number of children an outage has changes
class Outage < ApplicationRecord
has_many :children
after_update :if_length_changed
def if_length_changed
o = Outage.find_by_id(self.id)
if (o.children.any?(&:changed?) || o.children.collect(&:id).sort != o.children.pluck(&:id).sort)
puts "\n\nlength was changed, count: #{o.children.count}\n\n"
else
@ornerymoose
ornerymoose / tickets.rb
Created December 13, 2017 17:01
Attempting to run curl http://localhost:3000/api/v1/tickets.json -d {"heat_ticket_number": "123whatever", "customers_affected ": "34"} returns the following in server log: TypeError (compared with non class/module):
module API
module V1
class Tickets < Grape::API
include API::V1::Defaults
resource :tickets do
desc "Return all tickets"
get "", root: :tickets do
Ticket.all
end