Skip to content

Instantly share code, notes, and snippets.

@Dare-NZ
Dare-NZ / jquery_simple_lightbox.js
Last active December 17, 2015 00:49
A super simple lightweight jQuery lightbox function that accepts any HTML. May need some cross browser adjustments.
utilCreateLightbox : function(new_options) {
options = {
box_class : '',
box_content : '',
wrap_css : {
position : 'fixed',
left : 0,
top : 0,
width : '100%',
height : '100%',
@Dare-NZ
Dare-NZ / js_resize.php
Last active December 17, 2015 00:49 — forked from seedprod/vt_resize.php
Still getting the hang of gists apparently
<?php
/*
* Resize images dynamically using wp built in functions
* Based on the script by Victor Teixeira
* - Updated to use wp_get_image_editor()
* - Moves resized files to uploadpath/resized/
* Joe Swann
*
* php 5.2+
*
@Dare-NZ
Dare-NZ / css3_fontface.less
Last active December 17, 2015 00:49
Some of my most used CSS3 LESS styles, with a bonus @font-face simplifying function
.border-radius(@radius: 3px) {
border-radius: @radius;
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
}
.text-shadow(@color: #fff) {
text-shadow: 1px 1px 1px @color;
filter: dropshadow(color=@color, offx=1, offy=1);
}
@Dare-NZ
Dare-NZ / magic_grid.less
Last active December 17, 2015 00:49
Super simple 12 span grid system in LESS, use with or without media queries!
@wrap: 740px;
@gutter: 20px;
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.gridMake(@gutter : @gutter) {
@Dare-NZ
Dare-NZ / LESS_property_value.less
Last active December 17, 2015 00:49
This LESS snippet lets you use a .pv(@p,@v) class to set a property with a value.
//First version
.pv(@p,@v) {
@{p}:@{v}
}
//Second version
.pv(@p,@v) {
-:~`";@{p}:@{v}".replace(/'/g,"")`;
// -:~`";@{p}:@{v}".replace(/'/g,"")`;
}
@Dare-NZ
Dare-NZ / absPos_hList.less
Last active December 17, 2015 00:49
A couple of indespensible LESS functions for tedious CSS jobs
.hList {
list-style:none;
margin:0;
padding:0;
li {
margin:0;
padding:0;
display:inline-block;
*display:inline;
}
@Dare-NZ
Dare-NZ / SSH MYSQL commands
Last active December 17, 2015 00:49
Some SSH functions for backing up a MYSQL DB, zipping it and shipping it off to a remote server.
// Obviously {this} means replace with your version of this
// Dump DB
mysqldump -p -u {username} {dbname} > {dbname.sql}
// Tar DB
tar -cvf {dbname.tar} {dbname.sql}
// Move DB
curl -T {dbname.tar} ftp://{remote path}/{dbname.sql} --user {username}:{password} -v
function createLightbox(lightbox_content, lightbox_class) {
$('body').append('<div class="lightbox-wrap" ><div class="lightbox-position"><div class="lightbox ' + lightbox_class + '" /></div></div>');
$lightbox = $('.lightbox');
$lightbox_position = $('.lightbox-position');
$lightbox_wrap = $('.lightbox-wrap');
$lightbox_wrap.css({
position : 'fixed',
left : 0,
@Dare-NZ
Dare-NZ / wp_export_csv.php
Created May 9, 2013 00:52
A php file that takes a WP table and saves as a CSV
<?php
require_once('../../../../wp-load.php');
global $wpdb;
$wpdb->show_errors();
$table_name = $wpdb->prefix . "arg_signups";
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
newsletter_install();
@Dare-NZ
Dare-NZ / pagespeed.htaccess
Created May 9, 2013 01:00
The .htaccess I used to max out googles page speed score
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 200 hours"
ExpiresDefault "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/x-shockwave-flash A3600
<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>