Skip to content

Instantly share code, notes, and snippets.

View csdear's full-sized avatar

Stuart Dear csdear

View GitHub Profile
@csdear
csdear / Typical Web Page Jscript Wire Up IO ABC.js
Created March 7, 2016 17:15
Typical Web Page Jscript Wire Up I/O ABC
//WIRING A FUNCITON TO A UI ELEMENT :
//• Conceptually
// A. User Input to Trigger to Function Execution
// B. Function Execution
// C. Output
<!DOCTYPE html>
<html>
-- e.g., on a charge status table.
-- There mighte be a more effective bespoke way to do this in SSMS, as explicitly naming the
-- datatypes could be risky. Right clicking 'New Table' in SSMS perhaps...
-- the following creates a table 'charge_status'
-- columns arranged are charge_status_id cc_processor_invoice_id and success
-- charge_status_it is designated as the primary key.
-- it is a CLUSTERED index.
@csdear
csdear / INSERT INTO - Multiple Values Examples.sql
Created February 18, 2016 17:41
INSERT INTO - Multiple Values, multiple rows Examples
-- Add entries to the Camera table if you want it reflected in the dashboard. You will need the modem_id associated with each sn/meid combination
SET IDENTITY_INSERT camera ON
INSERT INTO camera (camera_id, camera_type_id, modem_id, user_id)
--VALUES (45, 1, 196, 23)
VALUES
(46, 1, 197, 23),
(47, 1, 198, 23),
(48, 1, 199, 23),
(49, 1, 200, 23),
(50, 1, 201, 23)
@csdear
csdear / Javascript TestGround
Created February 12, 2016 22:15
Javascript TestGround As Minimal as it can Get!!!
===HTML|program.html===
<html>
<body>
<pre>
<script src="program.js">
</script>
</pre>
</body>
</html>
@csdear
csdear / LEFT join Template.sql
Last active March 7, 2016 15:06
LEFT join Template
--A LEFT join example.
-- Join two aliased table on two keys they share in common
-- Further filtering via 'and' commands.
--1.
select * from modem m
left join camera c
on m.modem_id = c.modem_id
left join camera_value cv
on c.camera_id = cv.camera_id
@csdear
csdear / Insert Into with Identity Constraints.sql
Created January 14, 2016 17:07
Insert Into where there is an Identity Constraint
--e.g.
SELECT * FROM audit_log_type
SET IDENTITY_INSERT audit_log_type ON
INSERT INTO audit_log_type
(audit_type, description)
VALUES (12, 'Cancel Subscription')
SET IDENTITY_INSERT audit_log_type OFF
@csdear
csdear / ~CherryPick ~ Select Multiple.sql
Last active December 15, 2015 19:40
Select Multiple ~ CherryPick ~
--Can do this the long way with OR
SELECT * FROM apples
WHERE appleID = '5544' OR appleID = '5978'OR appleID = '1586' OR appleID = '4592'
--more efficient, using the IN keyword.
select * from modem where sn in ('1234', '4564', '4568', '1239')
@csdear
csdear / Insert Into with DATEADD, GETDATE Functions.sql
Created August 26, 2015 15:26
Insert Into w/ DATEADD & GETDATE Functions
SELECT * FROM user_notification
insert into user_notification
(user_id, notification_type_id, subject, body, user_deletable, created_on, expires_on, read_on, deleted_by_system, deleted_on)
values
(1, 1, 'subjectQA2', 'bodyQA2', 1, DATEADD(MINUTE, -10, GETDATE()), DATEADD(DAY, 180, GETDATE()), null, 0, null)
@csdear
csdear / Easy List and a Lambda Expression
Last active May 3, 2016 13:30
Easy List and a Lambda Expression
//linqpad as C# Program...
//using System;
//using System.Collections.Generic;
//For finding one quick element...
class Program
{
static void Main()
{
@csdear
csdear / Anonymous Function - Anonymous Method
Created July 17, 2015 22:03
Anonymous Function - Anonymous Method
//using System;
//using System.Collections.Generic
//derived from http://www.dotnetperls.com/anonymous-function
//ON section 'Anonymous Functions'
/*
KEY POINTS
The FindAll method used here in the anonyMethod syntax allows for filtering
of a list. This would be handy in the future if you have a list data type,
and you want to filter, based on MULTIPLE CONDITIONS.