Skip to content

Instantly share code, notes, and snippets.

View sebacruz's full-sized avatar
🤖

Sebastián Cruz sebacruz

🤖
View GitHub Profile
<div id="the-map"></div>
<script type="text/javascript" charset="utf-8">
google.load("maps", "2.x");
var map = new GMap2(document.getElementById('the-map'));
var icon = new GIcon(G_DEFAULT_ICON);
var center = new GLatLng(0, 0);
var bounds = new GLatLngBounds();
var points = [
<?php
/* Author: Peter Nelson / @_peterdn - controllers\url.php
* The main controller for the site. */
class Url extends Controller
{
public function Url()
{
parent::Controller();
$this->load->helper("url");
@sebacruz
sebacruz / csv_to_array.php
Created April 26, 2011 21:34 — forked from jaywilliams/csv_to_array.php
Convert a comma separated file into an associated array.
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@sebacruz
sebacruz / install-kohana.sh
Created October 17, 2011 15:08 — forked from shadowhand/install-kohana.sh
A script to install the Kohana PHP Framework
#!/bin/sh
# have submodules been added?
MODS=0
# Github base URL
GITHUB="https://github.com"
# Default branch
DEFAULT_BRANCH="3.0/master"
@sebacruz
sebacruz / user-usergroup-taxonomy.php
Created November 15, 2011 10:24 — forked from mjangda/user-usergroup-taxonomy.php
Using a taxonomy to store user-to-usergroup relationships
<?php
// Assuming we already have registered the taxonomy.
$usergroup_taxonomy = 'ef_usergroups';
// Tell WordPress that we can make associations between users and the usergroups taxonomy.
register_taxonomy_for_object_type( $usergroup_taxonomy, 'user' );
// Sample code
$user = WP_User( 1 );
@sebacruz
sebacruz / wpcom-open-graph.php
Created November 15, 2011 10:30 — forked from mjangda/wpcom-open-graph.php
Add Open Graph tags to your WordPress site
<?php
/**
* Plugin Name: WP.com Open Graph Tags
* Description: Add Open Graph tags so that Facebook (and any other service that supports them) can crawl the site better and we provide a better sharing experience
* @link http://ogp.me/
* @link http://developers.facebook.com/docs/opengraph/
*/
// Only enable for public blogs
@sebacruz
sebacruz / save-post-meta-helper.php
Created November 15, 2011 10:37 — forked from mjangda/save-post-meta-helper.php
Helper function to save post meta in custom metaboxes
<?php
/**
* Saves post meta value
*
* @param int ID of the post
* @param string Name of the post_meta key (same as the $_POST key and nonce name)
* @param string Name of the nonce key
* @param mixed The default value to be assigned if not set
*
* @return string Value that was saved
@sebacruz
sebacruz / gist:1445146
Created December 7, 2011 22:53
Aullido furioso
#show Aullido furioso
/stopattack
/stopcasting
/petfollow
/cast [target=Thorks] Aullido furioso(Rango 6)
/targetlastenemy
/petattack
/startattack
(function($) {
$.fn.oembed = function(url, options, callback) {
options = $.extend(true, $.fn.oembed.defaults, options);
return this.each(function() {
var container = $(this),
resourceURL = (url != null) ? url : container.attr("href"),
provider;
@sebacruz
sebacruz / cron.php
Created February 8, 2012 22:02 — forked from marcalj/cron.php
Kohana: i18n strings generator
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Cron extends Controller {
public function before()
{
// Set default language
I18n::$lang = Kohana::$config->load('i18n.default');
}