Skip to content

Instantly share code, notes, and snippets.

package net.abhinavsarkar.util;
import java.util.Iterator;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
<?php
$xml = <<<XML
<dl>
<dt>Cascading Style Sheets</dt>
<dd><p>Style sheets are used to provide presentational suggestions.</p>
<p>Documents structured using XML or HTML are able to make use of them.</p></dd>
<dt>Content Management</dt>
<dd>The process of collecting, managing and publishing content to various media.</dd>
<dd>A dirty job that no one wants.</dd>
<?php
Class Mysql extends mysqli{
public function __construct($registry){
// define registry property
$this->registry = $registry;
// initialize parent constructor
parent::__construct($this->registry->config->database->hostname, $this->registry->config->database->username, $this->registry->config->database->password, $this->registry->config->database->database);
}
<?php
Class Mysql extends mysqli{
private $revertDb = false;
public function __construct($registry){
// define registry property
$this->registry = $registry;
// initialize parent constructor
parent::__construct($this->registry->config->database->hostname, $this->registry->config->database->username, $this->registry->config->database->password, $this->registry->config->database->database);
#!/usr/bin/php
<?php
/**
* Incrementally downloads all comments from DISQUS.
*
* ``php import-comments.php``
*/
require_once(dirname(__FILE__) . '/../lib/wp-cli.php');
require_once(dirname(__FILE__) . '/../disqus.php');
#!/usr/bin/php
<?php
/**
* Incrementally downloads all comments from DISQUS.
*
* ``php import-comments.php``
*/
require_once(dirname(__FILE__) . '/../lib/wp-cli.php');
require_once(dirname(__FILE__) . '/../disqus.php');
/*
* Gordon: An open source Flash™ runtime written in pure JavaScript
*
* Copyright (c) 2010 Tobias Schneider
* Gordon is freely distributable under the terms of the MIT license.
*/
(function(ba){function D(d){return d/A.PX_IN_TWIPS}function ta(){this.list=this.next=null}function ua(){this.n=this.b=this.e=0;this.t=null}function fa(d,h,k,c,b,s){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var a=new Array(this.BMAX+1),z,m,o,g,j,p,w,i=new Array(this.BMAX+1),e,l,n,q=new ua,r=new Array(this.BMAX);g=new Array(this.N_MAX);var t,x=new Array(this.BMAX+1),v,B,u;u=this.root=null;for(j=0;j<a.length;j++)a[j]=0;for(j=0;j<i.length;j++)i[j]=0;for(j=0;j<r.length;j++)r[j]=
null;for(j=0;j<g.length;j++)g[j]=0;for(j=0;j<x.length;j++)x[j]=0;z=h>256?d[256]:this.BMAX;e=d;l=0;j=h;do{a[e[l]]++;l++}while(--j>0);if(a[0]==h){this.root=null;this.status=this.m=0}else{for(p=1;p<=this.BMAX;p++)if(a[p]!=0)break;w=p;if(s<p)s=p;for(j=this.BMAX;j!=0;j--)if(a[j]!=0)break;o=j;if(s>j)s=j;for(v=1<<p;p<j;p++,v<<=1)i
@tml
tml / Ancient Beast Bestiary
Created March 15, 2012 03:17 — forked from DreadKnight/Ancient Beast Bestiary
creatures displayed in table based levels and sins
<?php $page_title = "Ancient Beast - Bestiary";
include("../header.php");
include("../global.php");
?>
<script type="text/javascript" src="<?php echo $WorkingDir; ?>utils/tinybox.js"></script>
<?php
echo "$start_div<div style='text-align:center; position:absolute;'>";
$pdo = new PDO(...);
$q = $pdo->query("SELECT * FROM ab_creatures ORDER BY sin, lvl");
$rows = $q->fetchAll();
@tml
tml / mud-story.txt
Created October 11, 2012 16:50 — forked from anonymous/gist:3158796
Because you shouldn't have to put up with profanity...
to get a list of free programming books, here's the list from a Zed Shaw & Co. programming-related, profanity-filled website.
<div style="text-align: left">
<table>
<tbody><tr><th colspan="3">Programming Languages</th>
</tr><tr>
<td><a href="#Assembly Language">Assembly Language</a></td>
<td><a href="#Bash">Bash</a></td>
<td><a href="#C / C++">C / C++</a></td>
</tr>
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal