Skip to content

Instantly share code, notes, and snippets.

View richjenks's full-sized avatar
🏍️

Rich Jenkins richjenks

🏍️
View GitHub Profile
@richjenks
richjenks / snippets.ps1
Created April 16, 2016 07:59
PowerShell snippets
# Batch rename files (underscores to hyphens)
Dir | Rename-Item –NewName { $_.name –replace "_","-" }
# Get full path of all files
gci -r | where {$_.extension -match ".html|.htm|.php|.asp"} | select FullName
# Delete all files except...
gci -r | ? {$_.extension -notmatch ".html|.htm|.php|.asp"} | ? {-not $_.PsIsContainer } | remove-item
# Delete SVN folders
.ace_line {
white-space: normal !important;
text-indent: -1em;
padding-left: 1em;
}
@richjenks
richjenks / iframe.css
Created April 16, 2016 07:57
Responsive iframe
.responsive-iframe {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
height: 0;
}
.responsive-iframe iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
return uuid;
@richjenks
richjenks / backup.sh
Created April 16, 2016 07:56
Backup & Restore Linux
# Backup system to /backup.tgz
sudo su
cd /
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exclude=/media /
@richjenks
richjenks / custom-formats.php
Created April 16, 2016 07:55
CKEditor for GetSimple
<?php //Adds the format red to CKEditor with defined styles
define('GSEDITOROPTIONS', "
format_tags: 'p;h2;h3;h4;h5;h6;pre;small;red',
format_small: {
name: 'Small',
element: 'small'
},
format_red: {
name: 'Red',
function toggleFullScreen() {
var doc = window.document;
var docEl = doc.documentElement;
var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen;
var cancelFullScreen = doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen;
if(!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement) {
requestFullScreen.call(docEl);
}
else {
cancelFullScreen.call(doc);
USE database
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE '%attachment%'
AND TABLE_TYPE = 'BASE TABLE'
.pretty-underline {
color: inherit;
text-decoration: none;
background: -webkit-gradient(linear, 0 0, 0 100%, from(white), to(white));
background: -webkit-linear-gradient(white, white);
background: -moz-linear-gradient(white, white);
background: -o-linear-gradient(white, white);
background: linear-gradient(white, white), -webkit-linear-gradient(white, white), -webkit-linear-gradient(#333332, #333332);
background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
background-repeat: no-repeat, no-repeat, repeat-x;
background: repeating-linear-gradient(
45deg,
#606dbc,
#606dbc 10px,
#465298 10px,
#465298 20px
);