Skip to content

Instantly share code, notes, and snippets.

View rmdort's full-sized avatar

Vinay M rmdort

View GitHub Profile
@rmdort
rmdort / gist:10022895
Last active August 29, 2015 13:58
Regex Pick shortcode from html
$pattern = '/(?(?=<\S*>)<\S*>|)\s*(\[[a-z|A-Z|-|\/|\s|\"|\=]*\])\s*(?(?=<\/\S*>)<\/\S*>|)/';
$html = '<p>
[highlight type="note"]You and your confinement nanny are bound by the basic Work Permit conditions. For example, the nanny cannot work for other employers in an occupation other than that stated in the Work Permit.[/highlight]</p>';
$filtered = preg_replace($pattern, '$1', $html);
// Returns
/*
<blockquote>
<p>Written with <a href="https://stackedit.io/">StackEdit</a>.</p>
</blockquote>
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport(function( options ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !options.crossDomain || support.cors ) {
var callback;
return {
@rmdort
rmdort / index.html
Created September 27, 2010 04:33 — forked from boazsender/index.html
<!DOCTYPE html>
<html>
<head>
<title>Twitter Search Plugin</title>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="jquery.twitter.js"></script>
<style type="text/css">
.twitter-posts li {margin-bottom: 10px; font-size: 12px; clear: both; list-style-type:none;}
.twitter-posts li img {float:left; width: 48px; margin:0px 10px 10px 0px;border:1px solid #c2c2c2; -moz-box-shadow: 0px 0px 4px #c2c2c2; -webkit-box-shadow: 0px 0px 4px #c2c2c2; box-shadow: 0px 0px 4px #c2c2c2;}
.twitter-posts li a {text-decoration:none; color: #009;}
{exp:freeform:form form_name="tellafriend" required="name|email|senderemail"
send_user_email="yes" user_email_template="tellafriend" template="brief_version" return="seaawards/nominate/thankyou"}
<fieldset>
<label for="name">Your Name</label>
<input type="text" name="name" id="name" value="{if screen_name!=''}{screen_name}{/if}" />
</fieldset>
<fieldset>
<label for="senderemail">Your Email Address</label><input type="text" name="senderemail" id="senderemail" value="{email}" />
@rmdort
rmdort / jscrollpane.js
Created December 19, 2010 09:51
Added iOS and Android Support for jScrollPane
// Ipad Iphone
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))||(navigator.userAgent.match(/Android/i))) {
var isTouchScreen = 1;
}else{
var isTouchScreen = 0;
}
$container.bind('touchstart', function(e){
var cpos = dragPosition;
@rmdort
rmdort / routes_ee
Created December 19, 2010 18:36
Sammy.js Routes for Expression Engine
// Sammy Routes for Expression Engine
this.get('#/', function(context) {
this.partial('{path=sammy/home}');
context.app.swap();
});
this.get('#!/:url', function(context) {
this.partial('{path=sammy}/'+this.params['url']);
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Doodle.js Demo - Bouncy Balls</title>
<!--[if IE]>
<script type="text/javascript" src="http://explorercanvas.googlecode.com/svn/trunk/excanvas.js"></script>
<![endif]-->
<script type="text/javascript" src="http://cloud.github.com/downloads/biilly/doodle.js/doodle-0.1.1.min.js"></script>
#!/bin/env ruby
if ARGV.empty?
$stderr.puts <<-EOM
ExpressionEngine (1.x) MYSQL DUMP Localizer
1. Reads MYSQL DUMP of ExpressionEngine website from STDIN
2. Replaces ALL HOSTNAME & PATH data (config) with LOCAL SETTINGS
3. Output corrected MYSQL DYMP file.
<?php
/**
* Custom configuration bootsrtap file for ExpressionEngine
*
* Place config.php in your site root
* Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
* Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
* If you have moved your site root you'll need to update the require_once path
*