Skip to content

Instantly share code, notes, and snippets.

View AramZS's full-sized avatar
🎯
Focusing

Aram Zucker-Scharff AramZS

🎯
Focusing
View GitHub Profile
@AramZS
AramZS / shareCount.php
Last active August 29, 2015 13:56
PHP Sharecount
<?php
class shareCount {
private $url,$timeout;
function __construct($url,$timeout=30) {
$this->url=rawurlencode($url);
$this->timeout=$timeout;
}
function get_tweets() {
$json_string = $this->file_get_contents_curl('http://urls.api.twitter.com/1/urls/count.json?url=' . $this->url);
$json = json_decode($json_string, true);
@AramZS
AramZS / gAnalytics-template-tag.php
Last active August 29, 2015 13:56
A quick WordPress template tag to create Google Analytics Event Tracking on links. Built on behalf of CFO Publishing.
<?php
/**
* Get a safe string for custom variables or event tracking for Google Analytics.
*/
function get_for_google_analytics($string){
$string = strip_tags($string);
$string = remove_accents( html_entity_decode($string) );
$safe_string = esc_js( $string );
return $safe_string;
}
@AramZS
AramZS / modrewritetest.php
Created March 10, 2014 22:58
For testing if mod_rewrite is enabled.
<?php
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Check for mod_rewrite</title></head>
<body>
Test:
@AramZS
AramZS / sample_console_script.js
Created April 17, 2014 19:19
Allow you to call a script file from inside of Chrome console
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'http://someurl.com/somefile.js';
document.head.appendChild(script);
@AramZS
AramZS / fadeout.css
Created June 10, 2014 16:52
Faded out text
box:after {
content:"";
*zoom:1;
zoom:1;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=’#00e7e7e2’, endColorstr=’#e7e7e2’,GradientType=0 ); /* IE6-9 */
@AramZS
AramZS / network-related-objects.php
Created July 26, 2014 19:29
Some objects related to WP networks
@AramZS
AramZS / php_path_builder.php
Last active August 29, 2015 14:05
PHP Path Builder
<?php
/**
* Build file paths.
*
* Build paths with arrays Call out of static function class_name->build_path
* or self::build_path. Use like:
*
* build_path(array("home", "alice", "Documents", "example.txt"));
*
* @see http://php.net/manual/en/dir.constants.php
@AramZS
AramZS / pf-ive-read.php
Created February 3, 2015 19:45
pf_ive_read
// Add Shortcode
function pf_total_wordcount_shortcode() {
$wc = 0;
$c = 0;
$the_query = new WP_Query(
array(
'nopaging' => true,
'date_query' => array(
'column' => 'post_date_gmt',
'after' => '30 days ago',
@AramZS
AramZS / bitly-response.php
Created February 3, 2015 22:35
What a Bit.ly-style redirect looks like as a wp_remote_get response.
<?php
# via var_dump(wp_remote_get('http://nzzl.me/1xqgPpn',array('redirection' => 0)));
array(5) {
["headers"]=>
array(9) {
["server"]=>
string(5) "nginx"
["date"]=>
@AramZS
AramZS / the-url-is-over-there.html
Last active August 29, 2015 14:14
Normal Canonical and OG:URL code
<link rel="canonical" href="http://jezebel.com/be-suspicious-of-the-new-harper-lee-novel-1683488258" />
<meta property="og:url" content="http://jezebel.com/be-suspicious-of-the-new-harper-lee-novel-1683488258" />