Skip to content

Instantly share code, notes, and snippets.

View favrik's full-sized avatar
🏀

Favio Manriquez favrik

🏀
View GitHub Profile
@favrik
favrik / gist_embed.coffee
Created February 20, 2012 09:25 — forked from danott/gist_embed.coffee
Embed GitHub Gists without blocking the page.
# Asynchronously load GitHub Embeds
# Why?
# Because no web developer worth his weight in bacon salt wants to have blocking <script /> style embeds in his content.
# I want to be able to link to GitHub gists I write, and I want those links to show up in content aggregators as well.
# And then, if possibly, progressively enhance by embedding the gist.
#
# Usage, simply link to a gist. An entire gist, or an anchor tag to a particular file.
#
# Requires: jQuery and Modernizr
#
@favrik
favrik / tiny_mce.php
Created May 3, 2012 20:54
compiling script
<?php
$tiny_mce = realpath(__DIR__ ."/../../htdocs/js/tiny_mce");
require "$tiny_mce/tiny_mce_gzip.php";
$compressor = new TinyMCE_Compressor(array(
'base_path' => $tiny_mce,
'filename' => 'compiled.js',
'compress' => false,
@favrik
favrik / gist:2895301
Created June 8, 2012 12:08
mod.gmap.php
diff -r 9672935d0915 ee_system/expressionengine/third_party/gmap/mod.gmap.php
--- a/ee_system/expressionengine/third_party/gmap/mod.gmap.php Fri Jun 08 04:06:51 2012 -0700
+++ b/ee_system/expressionengine/third_party/gmap/mod.gmap.php Fri Jun 08 05:08:03 2012 -0700
@@ -1582,7 +1582,7 @@
$prep_fields = $this->EE->google_maps->prep_sql_fieldname($_POST, FALSE);
- $sql = 'SELECT `exp_channel_titles`.*, `exp_channel_data`.`entry_id`, `exp_category_posts`.`cat_id`,';
+ $sql = 'SELECT `exp_channel_titles`.*, `exp_channel_titles`.`title` as `entry_title`, `exp_channel_data`.`entry_id`, `exp_category_posts`.`cat_id`,';
$where = '';
@favrik
favrik / template.html
Created June 8, 2012 13:11
template.html
{embed="_includes/.html-header" title="Search Results for: {exp:search:keywords}"}
{embed="_includes/.main-page-images"}
<div class="main-column-left">
<h1 class="main-page-title">Interactive Map Search Results for: <em>{exp:search:keywords}</em></h1>
{exp:gmap:init id="map" class="gmap" style="width:100%;height:200px"}
@favrik
favrik / gist:3405662
Created August 20, 2012 16:40
Primera version del script para la migracion a drupal de leonarte.com
<?php
abstract class BaseMigration extends Migration {
public function __construct() {
// Always call the parent constructor first for basic setup
parent::__construct();
// With migrate_ui enabled, migration pages will indicate people involved in
// the particular migration, with their role and contact info. We default the
// list in the shared class; it can be overridden for specific migrations.
<?php
$router = Container::get('router');
foreach ($router->getRouteCollection()->all() as $objRoute) {
$arrDefaults = $objRoute->getDefaults();
if ($arrDefaults['_controller'] == 'frontend/article/list') {
var_dump($objRoute);
break;
}
}
/**
* $strPathList is in the form of an include_paht: .:/usr/local/lib:etc
*/
function GetValidPathFromList($strPathList) {
$arrPaths = explode(PATH_SEPARATOR, $strPathList);
foreach ($arrPaths as $strPath) {
if (file_exists($strPath)) {
return $strPath;
}
IncludeFromPathList(PAYPAL_PATH, 'ppsdk_include_path.inc');
$strPath = GetValidPathFromList(PAYPAL_PATH);
if ($strPath !== false) {
set_include_path($strPath . PATH_SEPARATOR . get_include_path());
}
@favrik
favrik / sphinx.conf
Created September 7, 2012 01:53
sphinx.conf
#############################################################################
## data source definition
#############################################################################
source users
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = k
@favrik
favrik / index_all.sh
Created September 7, 2012 02:00
Run the indexer on your local for Sphinxsearch
#!/bin/sh
cd /home/username/sphinx/
searchd --config sphinx.conf --stop
sleep 3;
indexer --config sphinx.conf users
indexer --config sphinx.conf users_by_username