Skip to content

Instantly share code, notes, and snippets.

View jackreichert's full-sized avatar

Jack Reichert jackreichert

View GitHub Profile
(function($) {
$(document).ready(function(e){
e.preventDefault();
$('input[name=titleSubmit]').click(function(){
$.ajax({
type: "GET",
url: SSL_Ajax.ajaxurl,
cache: false,
dataType: "jsonp",
crossDomain: true,
@jackreichert
jackreichert / make_dir
Last active August 29, 2015 14:21
Recursively make a directory in php
// helper method
function make_dir( $path, $permissions = 0777 ) {
return is_dir( $path ) || mkdir( $path, $permissions, true );
}
// for use inline
if ( ! file_exists( $path ) ) {
mkdir( $path, 0777, true );
}
@jackreichert
jackreichert / osx-showhide.sh
Created May 25, 2015 16:19
Show/Hide Files alias - OSX Yosemite
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES;
killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO;
killall Finder /System/Library/CoreServices/Finder.app'
/* Generated by: FontSquirrel */
@font-face {
font-family: 'corbert-regular';
src: url('corbert-regular-webfont-webfont.eot');
src: url('corbert-regular-webfont-webfont.eot?#iefix') format('embedded-opentype'),
url('corbert-regular-webfont-webfont.woff2') format('woff2'),
url('corbert-regular-webfont-webfont.woff') format('woff'),
url('corbert-regular-webfont-webfont.ttf') format('truetype'),
url('corbert-regular-webfont-webfont.svg#webfontregular') format('svg');
font-weight: normal;
@jackreichert
jackreichert / my_cforms_action_salesfoce
Created August 16, 2011 15:09
Integrate cforms II and Salesforce
function my_cforms_action($cformsdata) {
$formID = $cformsdata['id'];
$form = $cformsdata['data'];
$curl_connection = curl_init('https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8');
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
@jackreichert
jackreichert / my_cforms_action
Created August 16, 2011 15:07
cforms II custom function
/* <--- move or remove this line to uncomment functions below (and check the end as well!)
function my_cforms_action($cformsdata) {
### Extract Data
### Note: $formID = '' (empty) for the first form!
$formID = $cformsdata['id'];
$form = $cformsdata['data'];
### triggers on your third form
if ( $formID == '3' ) {
### Do something with the data or not, up to you
$form['Your Name'] = 'Mr./Mrs. '.$form['Your Name'];
object(stdClass)#131 (25) {
["ID"]=>
int(13)
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2011-07-31 12:45:36"
["post_date_gmt"]=>
string(19) "2011-07-31 12:45:36"
["post_content"]=>
@jackreichert
jackreichert / gradient.less
Created August 30, 2011 17:54
LessCSS Gradients (including ms-filter)
.gradient(@from: #cfe0ec, @to: #d1e4ef) {
background-color: @from;
background-image: -webkit-linear-gradient(top, @from, @to);
background-image: -moz-linear-gradient(top, @from, @to);
background-image: -ms-linear-gradient(top, @from, @to);
background-image: -o-linear-gradient(top, @from, @to);
filter: ~"progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=@{from}, endColorstr=@{to})";
-ms-filter: ~"'progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=@{from}, endColorstr=@{to})'";
}
@jackreichert
jackreichert / roundedCorners.less
Created August 30, 2011 17:44
LessCSS Rounded Corners
.rounded-corners (@radius: 5px) {
border-radius: @radius;
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
}
@jackreichert
jackreichert / jQuery.fontBefitting.js
Created September 13, 2011 21:34
jQuery function to resize fonts to fit a containing element.
$.fn.fontBefitting = function() { // This resizes fonts to make them fit in an element
return this.each(function() {
var fontSize = parseFloat($(this).css('fontSize'));
this.style.overflowY = 'scroll';
// This is if the font too big to fit an enclosing element
while (this.clientHeight < this.scrollHeight && fontSize > 1) {
fontSize *= 0.99;
$(this).css('fontSize',fontSize + 'px');
}
// This is if the font is too small