Skip to content

Instantly share code, notes, and snippets.

View chrisdempsey's full-sized avatar

Chris Dempsey chrisdempsey

View GitHub Profile
@mgirouard
mgirouard / destroy-sample-data.php
Created October 1, 2010 02:02
A quick hack to destroy all sample data in an OpenCart catalog.
<?php
$options = getopt('p:');
$prefix = empty($options['p'])
? realpath('.')
: realpath($options['p']);
if (empty($prefix)) {
die("Bad prefix. Try again.\n");
}
<?php
$output = '';
$tElementClass = !empty($tElementClass) ? $tElementClass : 'modSnippet';
$tStart = $modx->getMicroTime();
if (!empty($tElement)) {
switch ($tElementClass) {
case 'modChunk':
$output = $modx->getChunk($tElement, $scriptProperties);
break;
@rantastic
rantastic / vimeo_thumbnail.php
Last active October 3, 2017 11:32
PHP: Get Vimeo Thumbnail From Link
function video_image($url){
$image_url = parse_url($url);
$ch = curl_init('http://vimeo.com/api/v2/video/'.substr($image_url['path'], 1).'.php');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$a = curl_exec($ch);
$hash = unserialize($a);
return $hash[0]["thumbnail_medium"];
}
@christianhanvey
christianhanvey / modx-snippets.php
Last active June 14, 2023 13:02
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@krismas
krismas / argv.php
Last active August 3, 2019 16:37
A small MODX snippet to extract POST, GET, SESSION & COOKIE values
<?php
/*
* A small MODX snippet to extract POST, GET, SESSION & COOKIE values - (c) 2012-2016 ackwa.fr
*
* @version : 1.0.4
* @see : https://gist.github.com/gists/2853625
* @name : argv.php
* @author : g.noel@ackwa.fr
* @usage : [[!argv?key=`myparam`&default=`1`]] -> return the value
* [[!argv?key=`myparam`&default=`1`&toph=`1`]] -> set [[+argv.myparam]]
@christianhanvey
christianhanvey / links
Created July 24, 2012 00:17
some useful reference links - in markdown
@nobuti
nobuti / gist:3816985
Created October 2, 2012 07:11
MySQL tables for continent names, country names and their ISO codes
CREATE TABLE IF NOT EXISTS `continents` (
`code` CHAR(2) NOT NULL COMMENT 'Continent code',
`name` VARCHAR(255),
PRIMARY KEY (`code`)
) ENGINE=InnoDB;
INSERT INTO `continents` VALUES
('AF', 'Africa'),
('AS', 'Asia'),
('EU', 'Europe'),
@fomigo
fomigo / modx-snippets.php
Created October 9, 2012 12:03 — forked from christianhanvey/modx-snippets.php
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@atk
atk / ie10hack.css
Created November 6, 2012 14:43
IE10 hack
/*
#ie10 will only be red in MSIE 10,
both in high contrast (display setting) and default mode
*/
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
#ie10 { color: red; }
}
@chrisjlee
chrisjlee / drupal-views-share-global-text-field
Last active April 23, 2024 04:07
share url's for facebook, twitter, pinterest with just get variables
<ul>
<li class="share-text">Share this>/li>
<li class="share-tw"><a href="http://twitter.com/share?text=[title]"><span></span></a></li>
<li class="share-fb"><a href="http://www.facebook.com/sharer.php?u=/node/[nid]&p=[title]"><span></span></a></li>
<li class="share-pinterest"><a href="http://pinterest.com/pin/create/button/?url=/node/[nid]&description=[title]"><span></span></a></li>
</ul>