Skip to content

Instantly share code, notes, and snippets.

View martinshaw's full-sized avatar
🚀

Martin Shaw martinshaw

🚀
View GitHub Profile
@martinshaw
martinshaw / before-shutdown.js
Created February 24, 2024 22:25 — forked from nfantone/before-shutdown.js
Node.js graceful shutdown handler
'use strict';
/**
* @callback BeforeShutdownListener
* @param {string} [signalOrEvent] The exit signal or event name received on the process.
*/
/**
* System signals the app will listen to initiate shutdown.
* @const {string[]}
import Network;
import JSON;
+ GeolocationProvider inherits \Objects\MappableAdopter<Float, Float>{
public f constructor <> {
\Network\Fetch({
Method: 'GET',
URL: \Network\Path <String "http://iplocation.net/api/" +toString<\Network\ClientIPAddress> >,
isSuccessful: <\Network\FetchResponse response> {
yield new \JSON\JsonObject {
@martinshaw
martinshaw / Message.rna
Created December 16, 2017 10:37
Need to implement ID
+ Message inherits \MySQL\DAO\Model {
String tables = "messages";
String msgContents = null;
String msgOrigin = null;
String msgRecipient = null;
Boolean isFirstSave = true;
public f constructor <
String _msgContents,
@martinshaw
martinshaw / test.php
Created November 4, 2017 21:00
Get requests sent to the raw version of this file while testing CRWA1
{
"status": "ok"
}
f Main <String[] args> {
yield new \GeoChat\GeoServices\Coord <
\FloatUtils\Float _latitude,
\FloatUtils\Float _longitude
>;
f isContainedInPolygon <\GeoChat\GeoServices\Polygon _polygon>{
// Check Contraints
\var rectangularCheck = Reduce <_polygon.points.asArray, Int> (_point, i) => {
\var latCheck = (_point.latitude < @_latitude);
\var longCheck = (_point.longitude < @_longitude)
@martinshaw
martinshaw / notes.md
Last active November 3, 2017 10:46
!!! Notes for Crypto-Ransomeware Assignment !!!

1 Substitution Algo 1 Transposition Algo

Combine for CRWA

C = Cyphertext M = Plaintext message K = Key E = Encrypt Function

class Routes extends Polarlicht3/HTTPRoutesManager
public f Main<>
@RegisterRoute <String "/", new Polarlicht3/Examples/Controllers/Welcome>;
@RegisterRoute <String "/signin", new Polarlicht3/Controllers/Auth/Signin>;
@RegisterRoute <String "/register", new Polarlicht3/Controllers/Auth/Register>;
@martinshaw
martinshaw / cookieclicker.js
Last active December 24, 2015 22:29
Cookie Clicker Hack. Duh...
w= window; d= document; d.g= {DT: this}; d.e= {DT: this};
d.g.t= function(n){ return this; }; d.g.m= function(i){ return 1/i; };
d.g.r= $; d.g.y= "#bigCookie"; d.g.a= 0; d.g.z= "click";
d.g.h= "console|log"; d.g.b= "|";
d.e.s= setInterval( function(){
w[d.g.h.split(d.g.b)[0]][d.g.h.split(d.g.b)[1]](d.g.a + " Cookies generated by script");
}, d.g.m(.1)*500);
d.e.g= setInterval( function(){
d.g.r(d.g.y)[d.g.z]();
d.g.a= d.g.a+1;
@martinshaw
martinshaw / location.coffee
Created July 15, 2013 14:42
Location Services embedded into posts
$ ->
composer= composer or {}
composer.locationservices=
showPosition: (position) ->
document.geoclocation=[
position.coords.latitude
position.coords.longitude
]
getlocation: ->
if navigator.geolocation