Skip to content

Instantly share code, notes, and snippets.

View cecilemuller's full-sized avatar

Cecile Muller cecilemuller

View GitHub Profile
@cecilemuller
cecilemuller / _extension.js
Created March 4, 2012 14:14
jQuery events from non-DOM objects (supports chaining)
/************************
* Class definition
************************/
var MyObjectClass = function(parameters){
var $ = jQuery;
var context = this;
/**
@cecilemuller
cecilemuller / gist:1973201
Created March 4, 2012 14:23
Programmatically change the active theme in Drupal 7
<?php
/**
* Defines a theme callback function per registered path.
*/
function MODULENAME_menu_alter(&$items) {
$items['node/%node']['theme callback'] = 'MODULENAME_default_node_theme';
$items['node/%node/edit']['theme callback'] = 'MODULENAME_edit_node_theme';
$items['node/%node/edit']['theme arguments'] = array(1);
}
@cecilemuller
cecilemuller / gist:2135802
Created March 20, 2012 13:48
Calculate the Viewpoint orientation to look at a specific target position in VRML or X3D
/**
* `target` is where you want to look at.
*
* `position` is the SFVec3f location of your viewpoint.
*
* `orientation ` is the resulting SFRotation of your viewpoint.
*
* Optionally, modify `new SFVec3f(0, 0, -1)` to change the roll.
*
*/
@cecilemuller
cecilemuller / scene.wrl
Created March 28, 2012 14:57
Stretch an image to cover the whole screen regardless of screen size or ratio, in VRML or X3D
Layer3D {
size 1 1
translation 0 0
viewpoint ViewVolume {
position 0 0 0.725
size 4 3
aspectMode "STRETCH"
}
children Shape {
appearance Appearance {
@cecilemuller
cecilemuller / mime.types
Last active October 2, 2015 22:58
Nginx support for 3D file formats mimetypes (VRML, X3D and Collada)
application/x-bskey bskey;
model/vrml wrl wrz;
model/x3d-vrml x3dv;
model/x3d+xml x3d;
model/x3d+fastinfoset x3db;
model/vnd.collada+xml dae;
@cecilemuller
cecilemuller / scene.wrl
Created May 9, 2012 10:51
Save a screenshot programmatically in BS Contact
#VRML V2.0 utf8
Group {
children [
DEF sensor TouchSensor {}
Shape {
appearance Appearance {
material Material {}
}
@cecilemuller
cecilemuller / simulator.command
Created May 29, 2012 00:23
Build and start in XCode Simulator an Adobe AIR 3.3 beta 3 application for iOS 5.1 using shell commandline
#!/bin/bash
#
# This is a Mac OSX shell script, you can simply double-click to start it.
#
# This is where you downloaded the AIR SDK from http://labs.adobe.com/downloads/air3-3.html
AIR_SDK="/Applications/Adobe/AIR SDK/AIR SDK 3.3b3"
# iOS 5.0
@cecilemuller
cecilemuller / gist:3040272
Created July 3, 2012 15:00
Pixel size to Layer3D size (for BS Contact)
function initialize() {
refresh();
Browser.addRoute(Browser, 'windowSize', Browser.getScript(), 'refresh');
distance = viewpoint.position[2];
fieldOfView = viewpoint.fieldOfView;
}
function shutdown() {
Browser.deleteRoute(Browser, 'windowSize', Browser.getScript(), 'refresh');
@rodw
rodw / backup-github.sh
Last active May 15, 2024 02:33
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
#-------------------------------------------------------------------------------
# NOTES:
#-------------------------------------------------------------------------------
# * Under the heading "CONFIG" below you'll find a number of configuration
# parameters that must be personalized for your GitHub account and org.
# Replace the `<CHANGE-ME>` strings with the value described in the comments
# (or overwrite those values at run-time by providing environment variables).
@cecilemuller
cecilemuller / gist:3081372
Created July 10, 2012 05:37
PostgreSQL trigger: loop through the columns of NEW record (requires `hstore` extension)
DECLARE
r record;
BEGIN
FOR r IN SELECT (each(hstore(NEW))).*
LOOP
RAISE NOTICE '% value is %', r.key, quote_nullable(r.value);
END LOOP;
RETURN NEW;
END