Skip to content

Instantly share code, notes, and snippets.

View questions-for-mat.md

Questions for Mat!

We have been creating an API using Serverless.com

Here is an example of our Serverless config file

service: hello-self-member-api

provider:
  name: aws
View pizza_lols.py
person = input('Enter your name: ')
print('Hello', person)
while True:
response = input("I'm meeting Dave and Emma for pizza on Friday. Would you like to come, " + person + "?\n")
if response == "yes":
print("great! See you there")
break
View index-fr.js
const express = require('express');
const router = express.Router();
const script = {
"setup": {
"initial_stage_id": "0",
"initial_scores": {
"money": 0,
"tomatoes": 0,
@asmt3
asmt3 / addClasses.js
Created Dec 8, 2016
Add classes to elements matching a certain CSS selector in jQuery
View addClasses.js
$(function(){
var selector = '.some-class';
$(selector).each(function(){
var $element = $(this);
$element.addClass('some-other-class')
$element.addClass('and-another-class')
})
@asmt3
asmt3 / backupGenerator.sh
Created Nov 16, 2016
Script to do regular MySQL backup on TSO Hosts
View backupGenerator.sh
#!/bin/bash
#Database login credentials - need to be changed accordingly
dbHost="***"
dbName="**"
dbUser="***"
dbPass="***"
#How many days the backups should be kept for before being removed
keepBackupsFor="30"
View JustGiving Chrome Directive
app.directive('ggchrome', ['$http', '$q', '$timeout',
function($http, $q, $timeout) {
return {
link: function(scope, element, attr) {
var chromeBase = 'https://chrome.justgiving.com/clientonly/';
var container = element;
var footer = '';
var headcontent = '';
@asmt3
asmt3 / Vagrantfile
Created Sep 2, 2016
A Vagrant provisioning script to create an environment for Nginx/Node/Express/MySQL
View Vagrantfile
# VAGRANTFILE_API_VERSION = "2"
# VAGRANT_DOMAIN_NAME = "dev.xmas.justgiving.com"
# VAGRANT_IP_ADDRESS = "192.168.33.62"
# Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# config.vm.box = "hashicorp/precise64"
# config.hostmanager.enabled = true
# config.hostmanager.manage_host = true