Skip to content

Instantly share code, notes, and snippets.

<div class="input-prepend">
<span class="add-on">Day: </span
<select name="day" id="day" class="input-block-level">
<!-- 1 = Sunday ... -->
<!-- somewhere in a common location in your code: $days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); -->
<?php foreach($days as $d=>$n): ?>
<option value="<?php echo $d;?>" <?php if ($d == $col) echo 'selected="selected"'; ?>><?php echo $n?></option>
<?php endforeach; ?>
</select>
</div>
@tml
tml / gist:4428077
Created January 1, 2013 15:13 — forked from tredoe/gist:4419687

Thanks to languages like Go and Rust the developers can now build software for the command line that can run in every architecture and system where those languages can compile. And this is awesome, you code an application which can be compiled in Windows, Mac OS or Linux, getting a full market of users just like with web applications.

Now, the next step is create graphical applications using the same code for those systems. To get this goal is necessary to build libraries of low level that provide access to graphics, audio and input. Later can be built a graphical toolkit. Step by step.

#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@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>
@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();
/*
* 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
#!/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');
<?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);
<?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);
}