Skip to content

Instantly share code, notes, and snippets.

View BrianEmilius's full-sized avatar
🤣

Brian Emilius BrianEmilius

🤣
View GitHub Profile
@BrianEmilius
BrianEmilius / colorVars.css
Created January 31, 2019 19:22 — forked from softpunch/colorVars.css
CSS Variables For Color Manipulation
/* ----
css custom properties to manipulate color
MIT - 2017 - Soft Punch
https://gist.github.com/softpunch/
set initial "main" color via HSL values.
automatically calculate harmonies and variations of that color with pure css.
harmonies are determined solely by hue.
@BrianEmilius
BrianEmilius / main.js
Created January 14, 2019 11:13
eksempel på async promises
const db = require('../config/mysql')();
function doSomething() {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(), 5000);
});
}
function loopImages(images) {
return new Promise((resolve, reject) => {
@BrianEmilius
BrianEmilius / socket.c
Created September 10, 2018 16:34 — forked from nolim1t/socket.c
HTTP Request in C using low level write to socket functionality
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
Object.prototype.clear = function () {
while(this.firstChild) {
this.removeChild(this.firstChild);
}
return this;
};
const build = function (data) {
const article = document.createElement('article');
const heading = document.createElement('h1');
iptables -A INPUT -p tcp --dport 2299 -m state --state NEW -m recent --set --name ssh --rsource
iptables -A INPUT -p tcp --dport 2299 -m state --state NEW -m recent ! --rcheck --seconds 60 --hitcount 4 --name ssh --rsource -j ACCEPT
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
<?php
require_once 'functions.php';
if (requestMethodCheck('GET')) {
$myArray = getRequestArray(INPUT_GET);
$name = $myArray['name'];
$origin = $_SERVER['HTTP_REFERER'];
$ip = $_SERVER['REMOTE_ADDR'];
<?php
function requestMethodCheck($method) {
$requestMethod = filter_input(INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_SPECIAL_CHARS);
if ($requestMethod === $method) {
return true;
} else {
return false;
}
}
myRandomNumber = Math.floor(Math.random() * myArray.length)
myRandomItem = myArray[myRandomNumber]
document.write(myRandomItem)
xhr = new XMLHttpRequest()
url = "http://localhost/undervisning/reklamer/statistik.php"
xhr.open("POST", url, true)
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {