Skip to content

Instantly share code, notes, and snippets.

View marcelweder's full-sized avatar

Marcel A. Weder marcelweder

View GitHub Profile
#!/usr/bin/python
import sys
import ssl
if sys.argv[1:]:
PORT = int(sys.argv[1])
else:
PORT = 4443
@marcelweder
marcelweder / wtf-smooth-scroll.js
Created March 8, 2017 09:27
One of the whorst JS-Scroll 'Handler' ever. Don't use this shit! 😤
/*** Smooth scroll (IE-Scroll-Fix) ***/
Math.easeOut = function(t, b, c, d) {
t /= d;
return -c * t * (t - 2) + b;
};
(function() {
// do not mess global space
var
interval,
// scroll is being eased
@marcelweder
marcelweder / mac-vagrant-howto.rst
Created March 7, 2017 16:06 — forked from tbonesteaks/mac-vagrant-howto.rst
brew, vagrant, virtualbox, and vagrant file howto...

Vagrant on Mac w Virtualbox

NSoT engineers have built Vagrantfiles for you to deploy NSoT software in a multitude of linux environments. This tutorial will help you load a Macintonsh computer (OS X) with Vagrant, Virtual Box, and dependencies so that you can start virtual servers and test the software.

NSoT publishes complete installation instructions for linux distributions, branch versions, and Vagrantfiles in addition to, not an alternative for the pip install method:

$ pip-install nsot
@marcelweder
marcelweder / calc-pixel-to-rem.js
Last active September 16, 2016 08:11
REM Calculator
/**
* Calculate pixel to rem
* @param size [int] pixel size to convert
* @param base [int] html font-size in pixel
*/
function calcRem(size, base) {
return parseFloat((size / base).toPrecision(4));
}
@marcelweder
marcelweder / server-restarts.sh
Created September 15, 2016 10:29
Server Restarts (PHP7 and Apache2)
sudo service php7.0-fpm restart
sudo service apache2 restart
@marcelweder
marcelweder / inject-jquery.js
Created August 26, 2016 09:52
inject-jquery.js
var element = document.createElement("script");
element.src = "https://code.jquery.com/jquery-1.11.1.min.js";
element.integrity = "sha256-VAvG3sHdS5LqTT+5A/aeq/bZGa/Uj04xKxY8KM/w9EE=";
element.crossorigin = "anonymous";
document.body.appendChild(element);
@marcelweder
marcelweder / emmet-col-title-list.txt
Last active August 3, 2016 14:39
Emmet Col-Title-List
.col-md-3*4>(h3{Title})>(ul>li{Link}*4)
@marcelweder
marcelweder / countcssrules.js
Last active June 15, 2016 13:23
Count all CSS-Rules in WebClient
// See also: http://stackoverflow.com/questions/9906794/internet-explorers-css-rules-limits
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
@marcelweder
marcelweder / load-css-js.js
Last active June 15, 2016 13:24
Load a CSS files asynchronously
/*! loadCSS: load a CSS file asynchronously. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */
!function(e) {
"use strict";
var t = function(t, n, i) {
var o, a = e.document,
d = a.createElement("link"),
r = i || "all";
if (n) {
@marcelweder
marcelweder / ga.php
Last active September 14, 2016 06:25
Workaround to implement Google-Analytics script
<?php
/**
* Google-Analytics
* Do not forget to replace te ID (UA-00000000-0)
*/
$alternate = '(function(root){
root.GoogleAnalyticsObject = "ga";
root.ga = {q: [["create", "UA-00000000-0", "auto"]],l: 1 * new Date()};
})(this);';