Skip to content

Instantly share code, notes, and snippets.

View jdolan's full-sized avatar

Jay Dolan jdolan

View GitHub Profile
@jdolan
jdolan / get_menu.php
Created March 13, 2012 20:08
Drupal 7: Traversable taxonomy
<?php
/**
* Returns the menu items for the specified term and its children (recursively).
*
* @param $term
* The term instance.
*
* @return array
* The menu item(s), as a renderable array.
*/
@jdolan
jdolan / Example.cs
Created April 19, 2012 14:23
Unity3D deferred WWW loading
public class Example : MonoBehaviour {
// Some other state / variables here
// Load the specified JSON resource as the DataSet
IEnumerator Load(string url) {
WWW json = new WWW(url);
yield return json;
@jdolan
jdolan / Sslv3SocketFactory.java
Created May 14, 2012 19:28
Navigating the parils of SSLv2 with HttpClient
package co.cantina.http;
import java.io.IOException;
import java.net.Socket;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@jdolan
jdolan / pango.modules
Created July 9, 2013 14:42
Generated pango.modules for GtkRadiant Mac.
# Pango Modules file
# Automatically generated file, do not edit
#
# ModulesPath = @executable_path/../lib/pango/1.8.0/modules
#
@executable_path/../lib/pango/1.8.0/modules/pango-arabic-lang.so ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:*
@executable_path/../lib/pango/1.8.0/modules/pango-basic-coretext.so BasicScriptEngineCoreText PangoEngineShape PangoRenderCoreText common:
@executable_path/../lib/pango/1.8.0/modules/pango-basic-fc.so BasicScriptEngineFc PangoEngineShape PangoRenderFc common:
@executable_path/../lib/pango/1.8.0/modules/pango-indic-lang.so devaIndicScriptEngineLang PangoEngineLang PangoRenderNone devanagari:*
@executable_path/../lib/pango/1.8.0/modules/pango-indic-lang.so bengIndicScriptEngineLang PangoEngineLang PangoRenderNone bengali:*
@jdolan
jdolan / google-maps-projector-demo.js
Last active December 20, 2015 10:19
Google Maps v3 Projector
(function($) {
/**
* Instantiates a new Map for the specified container.
*
* @param {String} selector The jQuery selector to target.
* @param {Object} options The Google Maps options.
* @param {String} uri The URI to load Properties from.
*
* @constructor
@jdolan
jdolan / entities.def
Created October 12, 2013 15:06
Sample of entities.def for Quake2World.
/*QUAKED ammo_cells (.4 .7 1) (-16 -16 -16) (16 16 16) triggered no_touch hover
Cells for the Hyperblaster.
-------- Keys --------
team : The team name for alternating item spawns.
-------- Spawn flags --------
triggered : Item will not appear until triggered.
no_touch : Item will interact as solid instead of being picked up by player.
hover : Item will spawn where it was placed in the map and won't drop the floor.
@jdolan
jdolan / r_entity.c
Last active December 29, 2015 18:39
Projection shadows
/*
* @brief Applies any configuration and tag alignment, populating the model-view
* matrix for the entity in the process.
*/
static void R_SetMatrixForEntity(r_entity_t *e) {
vec_t *o = e->origin, *a = e->angles;
if (e->parent) {
vec3_t forward, tmp;
@jdolan
jdolan / r_bsp_model.c
Last active March 7, 2021 23:53
BSP surface unwinding for surface area calculation
/*
* @brief Unwinds the surface, iterating all non-collinear vertices.
*
* @return The next winding point, or NULL if the face is completely unwound.
*/
static const vec_t *R_UnwindBspSurface(const r_bsp_model_t *bsp, const r_bsp_surface_t *surf,
const vec_t *last) {
const int32_t *se = &bsp->surface_edges[surf->first_edge];
const vec_t *v0 = R_BSP_VERTEX(bsp, *se)->position;
@jdolan
jdolan / config.h
Created June 16, 2014 22:59
Quake2World config.h
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 to build a client. */
#define BUILD_CLIENT 1
/* Set to the canonical name of the target machine */
#define BUILD_HOST "x86_64-darwin13.1.0"
/* Define to 1 to build a master server. */
@jdolan
jdolan / JSON.c
Created December 13, 2014 19:51
Parse a JSON file into a Dictionary and query it with JSONPath.
Data *data = $(alloc(Data), initWithContentsOfFile, path);
Dictionary *dict = $$(JSONSerialization, objectFromData, data, 0);
Number *dataStoreInitConns = $$(JSONPath, objectWithPath, dict0, "$.web-app.servlet[0].init-param.dataStoreInitConns");
assert(10 == (int) dataStoreInitConns->value);
release(data);
release(dict);