Skip to content

Instantly share code, notes, and snippets.

View cfaria's full-sized avatar
🍊
Citius, altius, fortius... Communiter

Carlos Faria cfaria

🍊
Citius, altius, fortius... Communiter
View GitHub Profile
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@bainternet
bainternet / nocn.php
Created September 15, 2011 23:05
Function to get terms only if they have posts by post type
<?php
/**
* Function to get terms only if they have posts by post type
* @param $taxonomy (string) taxonomy name eg: 'post_tag','category'(default),'custom taxonomy'
* @param $post_type (string) post type name eg: 'post'(default),'page','custom post type'
*
*
* Usage:
* list_terms_by_post_type('post_tag','custom_post_type_name');
@jelcaf
jelcaf / Operaciones-Git
Last active May 15, 2024 15:31
Git Tips - Mini-trucos de Git para facilitarme la tarea
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@maxxscho
maxxscho / functions.php
Created March 17, 2012 12:48
Wordpress: Shortcode Empty Paragraph fix
function shortcode_empty_paragraph_fix($content)
{
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
@smeranda
smeranda / facebook_like-box_responsive.css
Created May 1, 2012 20:37
Flexible width layout for Facebook Like Box/Activity Stream to use in Responsive Designs
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
@strangerstudios
strangerstudios / my_pmpro_confirmation_redirect.php
Last active July 6, 2021 20:16
Redirect Paid Memberships Pro Confirmation to Another Page Based on Level
/*
This code will redirect users from the default PMPro confirmation page to a specific page depending on their level.
Set the confirmation_pages array. Array keys should be membership level ids and the values are the page ids. So array(1=>2) will redirect membership level with id = 1 to the page with id = 2.
*/
function my_pmpro_confirmation_redirect()
{
$confirmation_pages = array(1 => 2); //change this use your membership level ids and page ids
global $pmpro_pages;
@raphaelstolt
raphaelstolt / php54_php53_pear_macports.markdown
Created May 17, 2012 21:37
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules

@jcypret
jcypret / twitalinkahashifyer.js
Last active January 22, 2018 16:25
JS: Twitalinkahashifyer!
/**
* The Twitalinkahashifyer!
* http://www.dustindiaz.com/basement/ify.html
* Eg:
* Ify.clean('your tweet text');
*/
Ify = {
link: function(tweet) {
return tweet.replace(/\b(((https*\:\/\/)|www\.)[^\"\']+?)(([!?,.\)]+)?(\s|$))/g, function(link, m1, m2, m3, m4) {
var http = m2.match(/w/) ? 'http://' : '';
@Maksold
Maksold / local.xml
Last active May 28, 2021 20:02
#magento #xml - local.xml boilerplate
<?xml version="1.0"?>
<layout>
<default>
<!--Root/Default Layouts-->
<reference name="root">
<!--Appending Block-->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</reference>
<!--CSS and JS Files-->