Skip to content

Instantly share code, notes, and snippets.

var state = true;
var i = 0;
while (state){
i += 1;
if (i >= 9){
state = false;
}
console.log("i: ", i);
}
@ornerymoose
ornerymoose / send_weekly_report.rake
Last active August 1, 2017 20:21
running the ticket model code in rails console works fine, but as a custom rake task it returns no data ('rake send_weekly_report' from command line)
task :send_weekly_report => :environment do
Ticket.send_weekly_report
end
USE [OMNIA_ESUM_P_SUMD_CM]
GO
/****** Object: StoredProcedure [dbo].[DAIS_FST_TT_Close_Update] Script Date: 7/18/2017 8:57:15 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@ornerymoose
ornerymoose / controller.rb
Last active July 10, 2017 17:18
This issue is not consistent. Sometimes the generated csv file will have a double quote at the beginning and end, other times it won't.
CSV.open("test_file.txt", "w+", {force_quotes: false}) do |csv|
csv << ["#{ticket.attributes['TroubleTicketCreateDate'].strftime("%H:%M:%S")}
|#{ticket.attributes['TroubleTicketNumber']}
|#{ticket.attributes['WireCenter']}"]
end
def invalid_match
@match_not_found = [
:match_found => false,
:transfer_flag => false
]
end
def validate(item, offering_type)
if item == offering_type
"1"
else
"0"
end
end
CSV.open("tve-export.csv", "w") do |csv|
csv << ["HBO"]
@ornerymoose
ornerymoose / TVAnywhereNameAccountIDRefresh
Created June 14, 2017 03:09
sp for tva.dbo.TVAnywhereNameAccountIDRefresh
USE [TVAnywhere]
GO
/****** Object: StoredProcedure [dbo].[TVAnywhereNameAccountIDRefresh] Script Date: 6/13/2017 11:08:24 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@ornerymoose
ornerymoose / SUM_TVAnywhere
Created June 14, 2017 03:05
stored procedure in CM
USE [OMNIA_ESUM_P_SUM_CM]
GO
/****** Object: StoredProcedure [dbo].[SUM_TVAnywhere] Script Date: 6/13/2017 11:05:07 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@ornerymoose
ornerymoose / integers.cpp
Created June 9, 2017 22:18
this will print out 0
#include <iostream>
using std::cout;
using std::endl;
int main(){
int a = 10;
if (a > 0){
a = 0;
} else {
ENV["lookup_phone_query"]="select distinct dd.AccountCode,dd.AccountID,dd.BalanceCurrent,dd.Phone,'Summit' as Property
,fm.Id,fm.sMAC,fm.sSerialNumber,fm.EQUIPMENTTYPE_Name,fm.Comment,fm.ADDRESS_Zip,fm.iItemID,ServiceStatus,fm.iVideoSystemID,fm.PrdWireCenter_WireCenter as WireCenter
from
(select distinct dd.AccountCode,dd.AccountID,dd.BalanceCurrent,coalesce(pp.phone,dd.Phone) as Phone,ServiceStatus from
(select distinct ar.AccountCode,ca.AccountID,ar.BalanceCurrent,
coalesce(
nc.PHONE,nc.AlternatePhone) as Phone,sv.ServiceStatus from
[OMNIA_ESUM_P_SUM_AR].[dbo].[ArAccount] ar
left join [OMNIA_ESUM_P_SUM_CM].[dbo].[CusAccount]ca on ar.AccountCode=ca.AccountCode
left join [OMNIA_ESUM_P_SUM_CM].[dbo].[SrvService]sv on ca.AccountID=sv.AccountID