Skip to content

Instantly share code, notes, and snippets.

View cesarmiquel's full-sized avatar

Cesar Miquel cesarmiquel

View GitHub Profile
<?php
/**
* @file
* Tests for clientproject.
*/
class clientProjectFeatureTestCase extends DrupalWebTestCase {
/**
* getInfo() returns properties that are displayed in the test selection form.
@perusio
perusio / gist:1497464
Created December 19, 2011 14:32
How to have an "inline" robots.txt for development/private setups
## Here's the way to have Nginx return a robots.txt file that disallows all crawling by bots.
## This is useful for development and private sites.
location = /robots.txt {
return 200 "User-agent: *\nDisallow: /\n";
}
@pascalduez
pascalduez / demo.module
Created December 24, 2011 15:02
Drupal 7 — Basic Ajax form submit (Ajax framework)
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/
@sdqali
sdqali / .gitignore
Created February 3, 2012 21:39 — forked from sit/.gitignore
A basic .gitignore file for Hudson configurations
# The following ignores...
# Miscellaneous Hudson litter
*.log
*.tmp
*.old
*.bak
*.jar
*.json
# Linux user files
#/usr/bin/env bash
JENKINS_HOME=/var/lib/jenkins
cd $JENKINS_HOME
git add *.xml jobs/*/config.xml users/*/config.xml userContent/*
CHANGES_TO_BE_COMMITTED=$(git status | grep "^# Changes to be committed:" | wc -l)
if [ $CHANGES_TO_BE_COMMITTED -eq 0 ]; then
echo "Nothing to commit"
@sanguis
sanguis / gist:1754684
Created February 6, 2012 20:39
taxonomy_form_options($machine_name) Drupal 7
<?php
/**
* returns a array for use with #options in a form field
* */
function taxonomy_options_array($machine_name, $all = NULL) {
$v = taxonomy_vocabulary_machine_name_load($machine_name);
if (!empty($all)) {
$options[$all[0]] = $all[1];
}
@gasman
gasman / pnginator.rb
Created April 30, 2012 18:08
pnginator: pack Javascript into a self-extracting PNG
#!/usr/bin/env ruby -w
# pnginator.rb: pack a .js file into a PNG image with an HTML payload;
# when saved with an .html extension and opened in a browser, the HTML extracts and executes
# the javascript.
# Usage: ruby pnginator.rb input.js output.png.html
# By Gasman <http://matt.west.co.tt/>
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos
@marktheunissen
marktheunissen / htmlfiles_migration.inc.php
Created May 4, 2012 18:32
HTML Files Migration into Drupal using Migrate
<?php
class MyMigration extends Migration {
public $base_dir;
/**
* Constructor.
*/
public function __construct() {
parent::__construct();
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 21, 2024 01:45
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname