Skip to content

Instantly share code, notes, and snippets.

View angelcosta's full-sized avatar
🏠
Working from home

Angel Costa angelcosta

🏠
Working from home
View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@chsh
chsh / fa-icon-external-link.css
Created April 9, 2012 05:32
Show icon after external link using Font Awesome
@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

@01-Scripts
01-Scripts / fa-icon-external-link.css
Created June 28, 2012 10:24 — forked from chsh/fa-icon-external-link.css
Show icon after external link using Font Awesome
@carstingaxion
carstingaxion / gist:3070690
Created July 8, 2012 12:21
Countdown Shortcode for WordPress
<?php
function countdown_shortcode ( $atts ) {
extract( shortcode_atts( array(
'date' => '',
), $atts ) );
if ( !isset($date) )
return false;
return '<span class="countdown">'.floor( ( strtotime( $date ) - time() )/60/60/24 ).'</span>';
@kyleweiner
kyleweiner / PHP Set Timezone By Offset
Created January 7, 2013 06:43
PHP: A snippet for setting the default timezone using a GMT offset.
// Set the default timezone using a GMT offset
$offset = -5; // GMT offset
$is_DST = FALSE; // observing daylight savings?
$timezone_name = timezone_name_from_abbr('', $offset * 3600, $is_DST); // e.g. "America/New_York"
date_default_timezone_set($timezone_name);
@tobysteward
tobysteward / BlogController.php
Last active March 4, 2024 23:11
Laravel AJAX Pagination with JQuery
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
@refringe
refringe / sendy-server
Last active February 5, 2024 07:50
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen 80;
listen [::]:80;
server_name domain.com;
autoindex off;
index index.php index.html;
root /srv/www/domain.com/public;
@ihorvorotnov
ihorvorotnov / wp-sharedcount
Last active October 28, 2017 15:00
WordPress - count shares via Sharedcount.com
/**
* http://www.sharedcount.com/documentation.php
*/
function social_shares() {
$url = get_permalink( $post_id );
$json = file_get_contents("http://api.sharedcount.com/?url=" . rawurlencode($url));
$counts = json_decode($json, true);
$totalcounts= array(
"twitter" => $counts["Twitter"],
"facebook" => $counts["Facebook"]["total_count"],
@manfromanotherland
manfromanotherland / formspree.html
Last active July 3, 2024 14:24
JS: Ajax send forms using the most excellent Formspree » http://formspree.io #snippet
<form id="contact-form" action="//formspree.io/your@email.com" method="post">
<input type="text" name="Name" placeholder="Name" required>
<input type="email" name="Email" placeholder="Email" required>
<textarea name="Message" cols="30" rows="6" placeholder="Message" required></textarea>
<!-- CONFIG -->
<input class="is-hidden" type="text" name="_gotcha">
<input type="hidden" name="_subject" value="Subject">
<input type="hidden" name="_cc" value="email@cc.com">
<!-- /CONFIG -->
<input class="submit" type="submit" value="Send">