Skip to content

Instantly share code, notes, and snippets.

View rafasashi's full-sized avatar
👍
Happy

Raphaël Dartigues rafasashi

👍
Happy
View GitHub Profile
<?php
if (!isset($_SESSION['user'])) {
require_once( COMPONENTS . "/user/class.user.php" );
$_SESSION['user'] = $_SERVER['PHP_AUTH_USER'];
$_SESSION['lang'] = 'en';
$_SESSION['theme'] = 'default';
$_SESSION['project'] = '/var/www';
$User = new User();
@rafasashi
rafasashi / README.rst
Last active August 29, 2015 14:22 — forked from dupuy/README.rst

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

Gearman can be installed on Windows through cygwin.

Install Cygwin packages

Install cygwin packages (through setup.exe):

  • gcc
  • make
  • libuuid1-devel
  • libiconv
@rafasashi
rafasashi / parser.php
Last active August 29, 2015 14:21 — forked from martinsik/parser.php
<?php
$curl = curl_init('http://www.livescore.com/soccer/england/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10');
$html = curl_exec($curl);
curl_close($curl);
if (!$html) {

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

<?php
$link=mysql_pconnect($db['write']['host'],$db['write']['user'],$db['write']['pass']) or die ("Could not connect to datadase");
mysql_select_db($db['write']['name']) or die ("could not select database");
//patharray is an essentially an exploded $_SERVER['REQUEST_URI']
//for articles rss feeds it would be /rss/articles/categoryname
//so $patharray[0]='rss', $patharray[1]='articles' and $patharray[2]='categoryname'
const('SITENAME','Example.com');
const('WEBMASTER','test@example.com (test@example.com)');

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">