This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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? | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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" | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$val = "1,234,988.56"; | |
$num = floatval(str_replace(",","",$val)); | |
echo $num; | |
// returns - 1234988.56 |