Skip to content

Instantly share code, notes, and snippets.

Joey Smith tml

Block or report user

Report or block tml

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:786efd2404ebb5fa8085
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
View visitor.js
function parse(str) {
var ir = Packages.jdk.nashorn.internal.ir;
var runtime = Packages.jdk.nashorn.internal.runtime;
var parser = Packages.jdk.nashorn.internal.parser;
var context = runtime.Context.getContext();
var source = new runtime.Source('test', str);
var node = new parser.Parser(context.getEnv(), source, new runtime.Context.ThrowErrorManager(), true).parse();
var lexContext = new ir.LexicalContext();
View HTML_Definition_List_Example.php
<?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>
View gist:1171975
<?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);
}
View gist:1172056
<?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);
View gist:1302705
#!/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');
View gist:1302715
#!/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');
View gordon.js
/*
* 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 Mar 15, 2012 — forked from DreadKnight/Ancient Beast Bestiary
creatures displayed in table based levels and sins
View Ancient Beast Bestiary
<?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();
View Evolution of a Python programmer.py
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
You can’t perform that action at this time.