Skip to content

Instantly share code, notes, and snippets.

View iainplimmer's full-sized avatar

NewZeroRiot iainplimmer

View GitHub Profile
git checkout upstream/master ../Scout7Api/Web.config
vm.countries = Array.from(new Set(result.data.map(item => item.country_Name)));
(function(){
// Create the body and master token to send over
const masterToken = 'Sc7K4CpdQ';
const dataToSend = {
username: 'iain@email.com',
sitename: 'website',
token: masterToken
};
@iainplimmer
iainplimmer / gist:3c505718415d3ce51a4602821df3cf6f
Created October 6, 2017 10:03
URL REGEX - Regular Expression
(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9]\.[^\s]{2,})
<script>
angular.module('fileUpload', [])
.controller('main', function () {
this.UploadFile = function () {
var filefield = document.getElementById('myfile');
if ('files' in filefield) {
for (var i = 0; i < filefield.files.length; i++) {
var file = filefield.files[i];
var formData = new FormData();
formData.append('filekey', file, file.name);
@iainplimmer
iainplimmer / constant handler.ashx
Created April 26, 2017 07:31
Javascript constants handlers!
<%@ WebHandler Language="C#" Class="Pipeline.JSConstantHelper" %>
using System;
using System.Web;
using System.Text;
namespace Pipeline
{
/// <summary>
/// The purpose of this HTTP handler is to give an accesibility to JS to consume all server level constants or configuration.
// Creating a prototype is as simple as making an object
var SuperHero = {
MakeSuper: function (_heroname, _superpower) {
this.heroName = _heroname;
this.superPower = _superpower;
},
UseSuperPower: function () {
return this.superPower.concat(' has been used by ', this.heroName);
}
}
<html ng-app="myApp">
<head>
<script src="./node_modules/angular/angular.min.js"></script>
<script>
angular.module('myApp', [])
.controller('cont', function ($scope) {
var vm = this;
// Create an object
function Person(firstname, surname, age) {
this.firstname = firstname;
this.surname = surname;
this.age = age;
this.fullname = function () {
return firstname + ' ' + surname;
}
};
@iainplimmer
iainplimmer / Patterns
Created December 3, 2016 13:23
Javascript patterns
<html>
<head>
<title>ES6 Testing</title>
<script>
// Using strict mode means variables NEED to be first defined!
// also, interface, let, package, private, protected, public, static, and yield are all reserved words.
//
//"use strict";
//mistypedVaraible = 17;