Skip to content

Instantly share code, notes, and snippets.

View filter_mania.js
var ele = details[i].elements.filter(e => !== null).findIndexPolyfill(e => == -1;
var cmts = details[i].elements.filter(e => e.cmts !== null).findIndexPolyfill(e => e.cmts.includes(query)) == -1;
if (query && ele){
ornerymoose / Component.vue
Last active Mar 5, 2020
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.
View Component.vue
<template slot="row-details" slot-scope="row">
<span :ticket_num="row.item.ticket_number"></span>
export default {
name: 'MaintenanceDetailsTable',
props: ['ticket_num'],
ornerymoose / controller.cs
Created Jul 12, 2019
the below works but isn't very clean.
View controller.cs
// 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" && == "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 / EmployeeController.cs
Last active Mar 14, 2019
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?
View EmployeeController.cs
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 == 1:
tts_obj = Tts(
region='Mountain West',
View maintenance.cs
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 / haversine.rb
Created Mar 13, 2018
fiber has 171k rows, customers has 21k rows
View haversine.rb
require 'csv'
require 'haversine'
fiber ="fiber/all_florida_fiber.csv", {headers: true}).first(3)
customers ="prospect_customers_geocoded.csv", {headers: true, encoding: 'ISO-8859-1'}).first(3)
hh = { |hsh,key| hsh[key] = [] }
#for each customer, loop through all the fiber coords
customers.each do |customer|
ornerymoose / outage.rb
Created Feb 8, 2018
trying to detect when the number of children an outage has changes
View outage.rb
class Outage < ApplicationRecord
has_many :children
after_update :if_length_changed
def if_length_changed
o = Outage.find_by_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"
ornerymoose / tickets.rb
Created Dec 13, 2017
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):
View tickets.rb
module API
module V1
class Tickets < Grape::API
include API::V1::Defaults
resource :tickets do
desc "Return all tickets"
get "", root: :tickets do