Skip to content

Instantly share code, notes, and snippets.

@digitup
digitup / mac.sh
Created November 5, 2016 18:59
Disable bunch of #$!@ in Sierra
#!/bin/bash
# This is a draft but it works
# FIRST (I don't even know if it works but we'll assume yes)
# sudo launchctl list
# sudo launchctl disable system/netbiosd
# sudo launchctl disable system/parsecd
# sudo launchctl disable system/parentalcontrols.check
# sudo launchctl disable system/airportd
@digitup
digitup / zsh.md
Created April 30, 2013 20:57 — forked from tsabat/zsh.md

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

and then you change your shell to zsh

chsh -s `which zsh`

and then restart

@digitup
digitup / LoadMultipleScriptsAsync.js
Created March 14, 2013 19:42
JavaScript - Load multiple 3rd party widgets asyncronously.
var script,
scripts = document.getElementsByTagName('script')[0],
scriptList = {
'plusone' : '//apis.google.com/js/plusone.js',
'twitter' : '//platform.twitter.com/widgets.js',
'someother': '//s.widgetsite.com/widget.js'
};
for (var id in scriptList) {
script = document.createElement('script');
@digitup
digitup / securePhpMyAdmin.sh
Created March 10, 2013 17:01
Server - Secure phpMyAdmin
//install phpmyadmin
sudo apt-get install phpmyadmin
//After the installation has completed, add phpmyadmin to the apache configuration.
sudo nano /etc/apache2/apache2.conf
//add phpmyadmin to config file
Include /etc/phpmyadmin/apache.conf
@digitup
digitup / database.sh
Last active December 14, 2015 18:28
Backup and restore database
rsync /var/lib/mysql root@destination.server.com:/var/lib/ -a
Or:
//Export Database
mysqldump -uUsername -p Database > db_backup.sql
 
//Export Multiple databases
mysqldump -uUsername -p --databases db_name1 [db_name2 ...] > db_backup.sql
@digitup
digitup / zip.sh
Created March 10, 2013 16:21
Server - Zip a folder
find /full_path -path '*/.*' -prune -o -type f -print | zip ~/file.zip -@
@digitup
digitup / GetURLParameters.js
Created February 25, 2013 12:33
JavaScript - Get URL Parameters
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
@digitup
digitup / windowWidth.html
Last active December 10, 2015 02:29
jQuery - windowWidth
<script>
$(window).resize(function() {
var windowWidth = $(window).width();
$('.screen-width').text(windowWidth + 'px');
});
</script>
<div id="debug" style="position:fixed;padding:0.3em 0.6em;background:#f1f1f1;font-size:0.6em;bottom:0;left:50%;">
<span class="screen-width">0</span>
</div>
@digitup
digitup / checkURLHash.js
Created December 20, 2012 14:31
JS - Check URL hash
function checkHash(backButton) {
if(window.location.hash) {
backButton = true;
} else {
backButton = false;
}
return backButton;