Skip to content

Instantly share code, notes, and snippets.

View jonluca's full-sized avatar

JonLuca De Caro jonluca

View GitHub Profile
@jonluca
jonluca / Keybase
Created August 24, 2017 00:24
Keybase
### Keybase proof
I hereby claim:
* I am jonluca on github.
* I am jonluca (https://keybase.io/jonluca) on keybase.
* I have a public key ASDsjXLhDp24xm9FCMS0jqWhF81R4Zd5Uz1ii5QzCHxingo
To claim this, I am signing this object:
@jonluca
jonluca / setVarToOne.cpp
Last active March 15, 2018 03:54
Testing Two
int mVar = 0;
void setVarToOne(){
mVar++;
}
setVarToOne();
ASSERTEQ(mVar,1); // true
@jonluca
jonluca / TestingZero.js
Created March 15, 2018 04:03
Testing zero
let mVar = 0;
function setVarToOne(mVar){
mVar = 1;
}
setVarToOne(undefined);
ASSERTEQ(mVar,0);
@jonluca
jonluca / TestingZero.cpp
Created March 15, 2018 04:09
Testing Zero
int mVar = 0;
void setVarToOne(int* mVar){
if(mVar) *mVar = 1;
}
setVarToOne(nullptr);
ASSERTEQ(mVar,0); //true
@jonluca
jonluca / TestingOne.cpp
Created March 15, 2018 04:10
Testing One
int mVar = 0;
void setVarToOne(int* mVar){
if(mVar) *mVar = 1;
}
setVarToOne(&mVar);
ASSERTEQ(mVar,1); //true
@jonluca
jonluca / TestingTwoToMaxMinusOne.cpp
Last active March 15, 2018 04:17
Testing Two to Max Minus One
void setVarToOne(int* mVar){
if(mVar) *mVar = 1;
}
std::srand(time(0));
int mVar = 0;
setVarToOne(&mVar);
ASSERTEQ(mVar,1); //true
@jonluca
jonluca / TestMax.cpp
Created March 15, 2018 04:21
Test Max
int mVar = INT_MAX;
void setVarToOne(int* mVar){
if(mVar) *mVar = 1;
}
setVarToOne(&mVar);
ASSERTEQ(mVar,1); //true
@jonluca
jonluca / TestingMaxPlusOne.cpp
Last active March 15, 2018 04:36
Test Max Plus One
#define MAX_SET_TO_ONE 1000
int mVar = 0;
int mTimesSetToOne = 0;
void setVarToOne(int* mVar){
if(mVar && mTimesSetToOne < MAX_SET_TO_ONE){
*mVar = 1;
mTimesSetToOne++;
}
@jonluca
jonluca / nginx.conf
Last active March 16, 2018 21:47
HTTPS Nginx Config
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name jonlu.ca www.jonlu.ca;
root /var/www/html;
index index.html index.htm;
location ~ /.git {
deny all;
@jonluca
jonluca / nginx.conf
Last active March 16, 2018 21:47
Original Nginx Config
server{
listen 80;
server_name jonlu.ca www.jonlu.ca;
root /var/www/html;
index index.html index.htm;
location ~ /.git/ {
deny all;
}
location ~ / {