Skip to content

Instantly share code, notes, and snippets.

View jasonglisson's full-sized avatar

Jason Glisson jasonglisson

View GitHub Profile
@jasonglisson
jasonglisson / 0_reuse_code.js
Created May 28, 2014 19:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jasonglisson
jasonglisson / strong-passwords.php
Created June 27, 2016 21:23 — forked from tylerhall/strong-passwords.php
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@jasonglisson
jasonglisson / click_slidetoggle.js
Created May 29, 2014 00:54
Slide toggle on click
$( "#clickme" ).click(function() {
$( "#book" ).slideToggle( "slow", function() {
// Animation complete.
});
});
@jasonglisson
jasonglisson / save_node.php
Last active September 14, 2017 01:57
Drupal 7: Create and save node programmatically
<?php
/**
* Basic Node Creation Example for Drupal 7
*
* This example:
* - Assumes a standard Drupal 7 installation
* - Does not verify that the field values are correct
*/
$body_text = 'This is the body text I want entered with the node.';
@jasonglisson
jasonglisson / git_rsync
Created May 29, 2014 01:21
Rsync using Git
git diff --name-only v0.3 v0.4 | xargs -I{} rsync -Rv "{}" ~/Desktop/destination-dir/
// Get # parameter
var param = document.URL.split('#')[1];
@jasonglisson
jasonglisson / wordpress_htaccess
Last active September 14, 2017 01:57
Wordpress: Default htaccess file http://codex.wordpress.org/htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@jasonglisson
jasonglisson / facebook_share_link
Last active September 14, 2017 01:58
Facebook: Link to open share dialog. Can be used in email, websites, etc. u=URL t=Title
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
@jasonglisson
jasonglisson / sequel_webform_query
Created June 4, 2014 15:54
Sequel Pro webform submissions query
SELECT webform_submitted_data.sid,
MAX(IF(`webform_submitted_data`.`cid` = 1, data, NULL)) firstname,
MAX(IF(`webform_submitted_data`.`cid` = 2, data, NULL)) lastname,
MAX(IF(`webform_submitted_data`.`cid` = 3, data, NULL)) email,
MAX(IF(`webform_submitted_data`.`cid` = 4, data, NULL)) zip,
MAX(IF(`webform_submitted_data`.`cid` = 5, data, NULL)) rfid
FROM webform_submitted_data
WHERE webform_submitted_data.nid = 1
GROUP BY webform_submitted_data.sid;