Skip to content

Instantly share code, notes, and snippets.

@ravinGit
ravinGit / d3 template
Created November 17, 2012 08:46 — forked from bebraw/gameengines.md
List of JS game engines. You can find a wikified version at https://github.com/bebraw/jswiki/wiki/Game-Engines. Feel free to modify that. I sync it here every once in a while.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="d3.js"></script>
<script type="text/javascript">
function draw(data){
"use strict";
//badass visualization code gone
<?
//connect to your database
//query comments for this page of this article
$inf = "SELECT * FROM `comments` WHERE page = '".stripslashes($_SERVER['REQUEST_URI'])."' ORDER BY time ASC";
$info = mysql_query($inf);
if(!$info) die(mysql_error());
$info_rows = mysql_num_rows($info);
@ravinGit
ravinGit / README.md
Created November 17, 2012 08:44 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@ravinGit
ravinGit / grid.css
Created November 17, 2012 08:34 — forked from JeffreyWay/grid.css
css: Simple CSS Grid in Stylus
//I'm using a preprocessor, called Stylus
full_width = 80
columns = 12
gutter = 1
.container
width unit(full_width, '%')
margin auto
overflow hidden
@ravinGit
ravinGit / gist:4094125
Created November 17, 2012 07:58 — forked from JeffreyWay/gist:2889230
Simple PHP Quiz
// Fun little quiz
Assuming this string: "January 5th, 2012"
In the shortest amount of code possible, place:
- 'January' within a $month variable
- '5th' within a $day variable
- '2012' within a $year variable.
@ravinGit
ravinGit / gist:4094112
Created November 17, 2012 07:53 — forked from JeffreyWay/gist:1268154
Lookups instead of Switch
<?php
# Instead of
$name = 'Jeff';
switch ($name) {
case 'Jeff':
echo "I'm Jeff";
break;
case 'Joe':
@ravinGit
ravinGit / set-value.md
Created November 17, 2012 07:39 — forked from JeffreyWay/set-value.md
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
@ravinGit
ravinGit / fb-fan-export.js
Created November 17, 2012 07:35 — forked from adamloving/fb-fan-export.js
Export Facebook Page Fans
/*
For more detailed instructions on how to use this script, sign up with your email here:
http://adamloving.com/internet-programming/how-toexport-facebook-page-fans
DISCLOSURE: This javascript runs in your browser pretending to be you
looking through your page fans. Facebook should have no problem with this,
but who knows if they will think it is strange to see you looking through
all your fans so quickly (the script waits 3s before requesting each page).
I've had no problem running this so far for 1000s of page fans, but I
@ravinGit
ravinGit / annoying.js
Created November 17, 2012 07:33 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@ravinGit
ravinGit / plugin-file.php
Created November 17, 2012 07:29 — forked from rmccue/plugin-file.php
Improved class concept
<?php
/*****
All new versions will be posted at
https://github.com/rmccue/Rotor_WPPlugin
Please use that repository instead of this Gist.
******/