Skip to content

Instantly share code, notes, and snippets.

View ruizfrontend's full-sized avatar
🎯
Focusing

David ruiz lópez ruizfrontend

🎯
Focusing
View GitHub Profile
@e0ipso
e0ipso / magic.php
Created September 13, 2013 09:33
Brief introduction to some OOP features present in PHP5.
<?php
/**
* A base class with getters and setters incorporated.
*/
class ObjectBase {
/**
* Setter function for a generic attribute.
*
* @param string $property_name
@ruizfrontend
ruizfrontend / gist:4656770
Last active December 11, 2015 20:38
Drupal 7 common functions & hooks
<?php
// _-______defining menu elements_______________________________
// (Including tpl theme)
/**
* Implements hook_menu().
*/
function MODULE_menu() {
$items['URL PATH'] = array(
'title' => 'TITLE',
'page callback' => 'CALLBACK FUNCTION',
@chrisallick
chrisallick / gist:3648116
Created September 5, 2012 23:57
Force preload of video in HTML5
function addSourceToVideo(element, src, type) {
var source = document.createElement('source');
source.src = src;
source.type = type;
element.appendChild(source);
}
var video;
@rjz
rjz / cs-jq-plugin-template.coffee
Created September 3, 2012 17:01
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
@tmcw
tmcw / index.html
Created July 7, 2012 19:15
MapBox markers.js with random points a dynamic factory, and changing factories on the fly
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://mapbox.com/markers.js/dist/markers.min.js'></script>
<script type='text/javascript'
src='http://mapbox.com/markers.js/dist/markers.externals.js'></script>
<link href='http://mapbox.com/markers.js/dist/markers.css'
rel='stylesheet' type='text/css' />
<style>
@davereid
davereid / custom.admin_menu.inc
Last active September 29, 2015 07:18
Useful D7 custom functions
<?php
/**
* @file
* Administration menu integration for the custom module.
*/
/**
* Implements hook_admin_menu_cache_info().
*/