Skip to content

Instantly share code, notes, and snippets.

@TechNinjaWeb
TechNinjaWeb / get-all-noc-codes.js
Last active October 27, 2017 10:06
Get the 500 Unit Group NOC codes from the Canadian Government site
// Requires jQuery (which is loaded on the page)
// Resource: http://www.cic.gc.ca/english/immigrate/skilled/noc.asp
// Ajax function that after successful run will return
// an array of all 500 unit group noc codes
// using the code as an index key
function GetAllNocCodes()
{
return new Promise((resolve, reject) =>
$.ajax({method: 'get', url: 'http://www.cic.gc.ca/english/immigrate/skilled/noc.asp', success: function(res){
@TechNinjaWeb
TechNinjaWeb / index.js
Last active October 24, 2017 15:20
Keyword and text summarization from url
const fs = require('fs')
const port = process.env.PORT || 5000
const express = require('express')
const app = express()
const http = require('http')
const bodyParser = require('body-parser')
const server = http.createServer(app)
const _ = require('lodash')
const textract = require('textract')
const pdf_extract = require('pdf-text-extract')
@TechNinjaWeb
TechNinjaWeb / CDO-product-rip.js
Last active September 19, 2017 15:39
Recursive async function to grab all products and their properties
//////////////////////////////////////////////////////////////////////
//////// Parse item saver prototype //////////
//////////////////////////////////////////////////////////////////////
Object.prototype.saveItemToParse = function(className, cb) {
var Obj = Parse.Object.extend(className);
var obj = new Obj(this);
// Callback for both error and success are the same
obj.save(null, { success: cb, error: cb });
}
@TechNinjaWeb
TechNinjaWeb / window-namespace-debugger.js
Last active August 8, 2017 17:39
Easily create an encapsulated namespace for your angular app's components, controllers, services, and other properties you want accessible from the console.
/*****************************************************************************************************
* Usage Example
*****************************************************************************************************/
// Get reference and set namespace
const WF = new WindowFactory('myCoolApp')
// Set Root
WF.root({name: 'MainModule'})
// Make additional Components
WF.make({name: 'SecondaryModule'})
// Attach components to any module by name
@TechNinjaWeb
TechNinjaWeb / script-loader.js
Last active July 27, 2017 10:20
Will take any array of cdn's and load them by pasting the code into the console.
/*************************************************
* Example Script Loader: will load any scripts
* from cdn by pasting this in the console.
*************************************************/
var scripts = loadScripts([
"https://code.jquery.com/jquery-3.2.1.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js",
"https://cdnjs.cloudflare.com/ajax/libs/parse/1.10.0/parse.js"
]);
<!-- Chrome Browser App Manifest json generator -->
<snippet>
<content><![CDATA[
{
"name": "TechNijaApp",
"version": "1.0",
"description": "Does every and anything you want it to!",
"icons": {
"16": "techninja_icon_16.png",
"48": "techninja_icon_48.png",
var answers = Array.prototype.slice.call(document.querySelectorAll('.e #cards .card.blur .back')).forEach(function(el){
el.offsetParent.onmouseover = function(ev){
el.offsetParent.classList.remove('blur')
el.previousElementSibling.style.display = 'none';
}
el.offsetParent.onmouseout = function(ev){
el.offsetParent.classList.add('blur')
el.previousElementSibling.style.display = 'block';
}
@TechNinjaWeb
TechNinjaWeb / cleverbot-conversation.txt
Last active January 25, 2017 21:08
cleverbot Q & A
-- Cleverbot Conversation String --
What is artificial intelligence?
I have a belief that you are artificial intelligence.
What makes you believe that I am artificial intelligence?
You were created artificially, and possess some rudimentary intelligence.
@TechNinjaWeb
TechNinjaWeb / frmMain.vb
Created January 24, 2017 23:09
Lab1B_Form_Code
Option Strict On
'#######################################################################################################
'Author: TechNinja
'Date: January 23, 2017
'Description: A Point of Sales system created for The Cantina Bar from Star Wars.
' It is designed to allow a user to select a type of drink,
' type of meal, and a set of snacks for purchase and will display totals
' for each category and a sum for all
'
'Credits: https://msdn.microsoft.com/en-us/library/6y3efyhx(v=vs.100).aspx
@TechNinjaWeb
TechNinjaWeb / Archers_End_Game_Score_Tracker.cpp
Created January 22, 2017 17:53
Archers End Game Tracker
/******************************************************************************
@filename: Archers_End_Game_Score_Tracker.cpp
@author: TechNinja
@date: January 15, 2017
@description: 3 Archers will compete in 4 rounds/ends. Each end will be
tracked and scored out of 60. The program will display each
archer's average end score and the overall match average.
@credits: http://www.cplusplus.com/forum/articles/9645/
*****************************************************************************/