Skip to content

Instantly share code, notes, and snippets.

View craiglondon's full-sized avatar

Craig London craiglondon

View GitHub Profile
@al-the-x
al-the-x / main.php
Created April 5, 2013 01:39
Coding Dojo at Orlando PHP 2013-04-04
<?php
/**
* Imagine a hallway (from the Matrix) with 50 doors on each side.
* Take a walk down the hallway and back up, opening every door.
* On a second pass, close all the even numbered doors.
* The third pass, each third door, close it if it's open and open if it's closed.
* Repeat.
* What is the state of the doors after 100 passes?
*/
@carolineschnapp
carolineschnapp / gist:5397337
Last active January 20, 2023 10:11
Sample JavaScript file added with ScriptTag resource. This sample file is meant to teach best practices. Your app will load jQuery if it's not defined. Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
/* Sample JavaScript file added with ScriptTag resource.
This sample file is meant to teach best practices.
Your app will load jQuery if it's not defined.
Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
Your app does not change the definition of $ or jQuery outside the app.
Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2'
once the app is installed, even if the app uses jQuery 1.9.1:
jQuery.fn.jquery => "1.4.2"
$.fn.jquery -> "1.4.2"
*/
@Turin86
Turin86 / WSSoapClient.php
Last active April 24, 2023 19:37 — forked from johnkary/WSSoapClient.php
WS-Security for PHP SoapClient
<?php
/**
* This class can add WSSecurity authentication support to SOAP clients
* implemented with the PHP 5 SOAP extension.
*
* It extends the PHP 5 SOAP client support to add the necessary XML tags to
* the SOAP client requests in order to authenticate on behalf of a given
* user with a given password.
*
@coliff
coliff / Bootstrap 3 - PIE.css
Last active January 10, 2023 11:56
Bootstrap 3 - PIECSS to quickly add border-radius to IE6,IE7,IE8 with CSS3 PIE (http://css3pie.com/). Be sure to add it as a conditional stylesheet for IE8 and lower.
.img-circle{behavior:url(/scripts/PIE.htc)}
.img-rounded{behavior:url(/scripts/PIE.htc)}
.img-thumbnail{behavior:url(/scripts/PIE.htc)}
.table-bordered{behavior:url(/scripts/PIE.htc)}
select,textarea,input,code,pre,kbd,pre{behavior:url(/scripts/PIE.htc)}
.input-group-addon{behavior:url(/scripts/PIE.htc)}
.btn{behavior:url(/scripts/PIE.htc)}
.dropdown-menu{behavior:url(/scripts/PIE.htc)}
.form-control{behavior:url(/scripts/PIE.htc)}
.panel{behavior:url(/scripts/PIE.htc)}
@branch14
branch14 / isbn13to10.rb
Created June 9, 2013 19:18
script to convert isbn13 to isbn10
#!/usr/bin/env ruby
# returns isbn10 if the given string represents a isbn13
# returns the given string otherwise
def isbn13to10(line)
isbn13 = line.tr_s('- ', '')
return line unless isbn13.match(/\d{13}/)
isbn10 = isbn13[3,9]
checksum = 0
@ludo237
ludo237 / .htaccess
Last active January 27, 2024 14:08
The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it.
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# This is the free sample of .htaccess from 6GO s.r.l.
# @author Claudio Ludovico Panetta (@Ludo237)
@zenorocha
zenorocha / .hyper.js
Last active November 12, 2023 15:13 — forked from millermedeiros/osx_setup.md
Setup macOS Sierra (10.12)
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
<?php
class EO_Shortcode_Grouped_Lists extends EventOrganiser_Shortcodes {
static function init() {
add_shortcode('eo_group_events_by_date', array(__CLASS__, 'handle_eventlist_shortcode'));
}
// Modified copy of orginal handle_eventlist_shortcode
static function handle_eventlist_shortcode($atts = array(), $content = null) {
# Based on https://gist.github.com/fernandoaleman/5083680
# Start the old vagrant
$ vagrant init ubuntu_saucy
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
@tristar500
tristar500 / String to Float.php
Created December 7, 2013 22:52
Convert string value with commas into a float
$val = "1,234,988.56";
$num = floatval(str_replace(",","",$val));
echo $num;
// returns - 1234988.56