View mailchimp-ajax.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- This works, but it's sketchy and leaves ur api key available for stealing --> | |
<!-- 17 revisions coz 8 tabs wtf github? --> | |
<head> | |
<title>Scetchy mailchimp form</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> | |
</script> | |
</head> | |
<body> |
View weather.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cron = require('node-schedule'), //npm install these or you're gna hae a bad time | |
loki = require('lokijs'), //loki is db with persistance coz saves json as a file | |
fetch = require('node-fetch') //browser fetch in node | |
let locations = ['London','Newcastle','Glasgow'] //or export an arr of locs in another file and require('./locations.js') | |
let openWeatherKey = '123456789abcdefghijk' //not a reel api key | |
let openWeatherUrl = (location) => { | |
return 'http://api.openweathermap.org/data/2.5/weather?q=' + location + ',uk&appid=' + openWeatherKey //change uk if you're grabbing data from elsewhere durr |
View proxy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// proxies requests to /folder to / on 8081 | |
// proxies requests to /folder2 to /folder2/ on 8081 | |
// all other requests sent to 8080 | |
// listens on 80 | |
var http = require('http'); | |
//2 dependencies, install them | |
var proxyRules = require('http-proxy-rules') | |
var websocket = require('http-proxy'); |
View Fibbonacier.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Fibbonacier = function() { | |
let cache = [1,1] | |
let step = () => { | |
let nums = [...cache] | |
let [a,b] = [nums.pop() || 1, nums.pop() || 1] | |
cache.push(a+b) | |
} | |
return { | |
step : step, | |
result: cache |
View oodler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//node oodler and visit localhost in browser and lol | |
var http = require('http') | |
http.createServer( (req,res) => { | |
res.writeHead(200, {'contentType' : 'text/html'}) | |
res.write( | |
` | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> |