Skip to content

Instantly share code, notes, and snippets.

View aronbudinszky's full-sized avatar

Aron Budinszky aronbudinszky

View GitHub Profile
@aronbudinszky
aronbudinszky / install-node-on-debian.sh
Last active December 19, 2015 04:59 — forked from clemherreman/install.sh
Installing Node.js on Debian.
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/joyent/node.git
cd node
# 'git tag' shows all available versions: select the latest stable.
git checkout enter-a-version
# Configure seems not to find libssl by default so we give it an explicit pointer.
# Optionally: you can isolate node by adding --prefix=/opt/node
@aronbudinszky
aronbudinszky / node-forever.sh
Created August 3, 2013 09:19
Start up a node script forever.
# Start up the script with forever
forever start /path/to/script.js -l /var/log/activity-log.log -o /var/log/activity-log.log -e /var/log/error-log.log -a --watch
# Using --watch will reload the server if the contents of the js file changes thereby allowing on-the-fly deployments
# -l is for logging forever output, -o is for program output, -e is for program error logs
# -a will append the logs
@aronbudinszky
aronbudinszky / sanitise-slash-bug.php
Last active December 21, 2015 10:28
A quick way to sanitise GET, POST, and REQUEST parameters while Facebook fixes the "slash bug": https://developers.facebook.com/bugs/567466826646137?browse=external_tasks_search_results_521473ef5f0e92913307282
/**
* Temporary GLOBAL Facebook fix for appended slash.
* - Keep in mind that this can have side-effects if you have any data where you ACTUALLY use / at the end.
* - Place this at the beginning of your code, preferably in a file that all of your apps include.
**/
foreach($_REQUEST as $key=>$val) $_REQUEST[$key] = rtrim($val, '/');
foreach($_GET as $key=>$val) $_GET[$key] = rtrim($val, '/');
foreach($_POST as $key=>$val) $_POST[$key] = rtrim($val, '/');
/**
@aronbudinszky
aronbudinszky / 1-ie-placeholder-polyfill.js
Last active December 23, 2015 11:19
A very short polyfill for IE placeholders. It's not meant to be perfect, but it is tiny and takes care of the most important use case for placeholders: to give additional info about how to fill it out. Requires jquery.
/** POLYFILL FOR IE PLACEHOLDER **/
$(document).ready(function(){
if(!('placeholder' in document.createElement('input'))){
$('input[placeholder]').each(function(){
if(this.value == ''){
var $el = $(this);
$el.bind('click', function(ev){ $(ev.target).unbind('click'); ev.target.value = ''; });
$el.val($el.attr('placeholder'));
}
});
@aronbudinszky
aronbudinszky / enable_mssql_firewall_rules.bat
Last active December 24, 2015 07:19
Run this script to enable all necessary ports on Windows Server 2012 Firewall for remote access to MS SQL. BE AWARE THAT THIS OPENS UP PORTS PUBLICLY! You should only use this on internal networks or if you have a hardware firewall.
netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80
@echo ========= SQL Server Ports ===================
@echo Enabling SQLServer default instance port 1433
netsh advfirewall firewall add rule name="SQL Server" dir=in action=allow protocol=TCP localport=1433
@echo Enabling Dedicated Admin Connection port 1434
netsh advfirewall firewall add rule name="SQL Admin Connection" dir=in action=allow protocol=TCP localport=1434
@echo Enabling Conventional SQL Server Service Broker port 4022
netsh advfirewall firewall add rule name="SQL Service Broker" dir=in action=allow protocol=TCP localport=4022
@echo Enabling Transact SQL/RPC port 135
<script>
function notify() {
var havePermission = window.webkitNotifications.checkPermission();
if (havePermission == 0) {
// 0 is PERMISSION_ALLOWED
var notification = window.webkitNotifications.createNotification(
'http://i.stack.imgur.com/dmHl0.png',
'Chrome notification!',
'Here is the notification text'
);
@aronbudinszky
aronbudinszky / select-styling-markup.html
Last active December 28, 2015 05:09
Nice, compact, mobile-friendly select styling.
<div class="select">
<select name="">
<option value="">&nbsp;</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
</div>
<script>
// select element styling
@aronbudinszky
aronbudinszky / date-and-timepicker-for-bootstrap3.html
Created November 13, 2013 18:42
Timepicker and datepicker for Bootstrap 3 with markup and Javascript init. Uses some template tags and variables from Outlast Framework.
<!-- Datepicker js -->
<script src="{{baseurl}}/system/site/js/bootstrap/3.0/plugins/datepicker/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="{{baseurl}}system/css/bootstrap/3.0/plugins/datepicker/bootstrap-datepicker.css"/>
{% if zaj.lang != 'en' %}
<script src="{{baseurl}}/system/site/js/bootstrap/3.0/plugins/datepicker/locales/bootstrap-datepicker.{{zaj.lang}}.js"></script>
{% endif %}
<!-- Timepicker js -->
<script src="{{baseurl}}system/js/bootstrap/3.0/plugins/timepicker/bootstrap-timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="{{baseurl}}system/css/bootstrap/3.0/plugins/timepicker/bootstrap-timepicker.css">
@aronbudinszky
aronbudinszky / redirect.xml
Created January 9, 2014 19:34
Open up web.config and add the following just before the closing system.webServer to force HTTPS in beautiful IIS.
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
@aronbudinszky
aronbudinszky / background-cover.js
Created January 17, 2014 15:32
Background cover with javascript.
var backgroundCover = function(){
var wh = $(window).height();
var ww = $(window).width();
var wa = ww / wh;
$('div.carousel div.element.article img').each(function(){
var $this = $(this);
var ar = $this.attr('width') / $this.attr('height');
if(wa < ar) $this.css({'height': wh, 'width': 'auto', 'position': 'fixed'});
else $this.css({'height': 'auto', 'width': ww, 'position': 'fixed'});
});