Skip to content

Instantly share code, notes, and snippets.

View cecilemuller's full-sized avatar

Cecile Muller cecilemuller

View GitHub Profile
@cecilemuller
cecilemuller / blurry.html
Created January 10, 2012 23:17
Blurry text on mouseover using CSS3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
body {
background: #333333;
}
@cecilemuller
cecilemuller / code.css
Created January 13, 2012 02:19
Display textfield labels in the style of fieldset legends
.fieldset {
position: relative;
font-size: sans-serif;
display: block;
width: 100%;
padding: 0;
margin: 20px 0;
height: 64px;
}
@cecilemuller
cecilemuller / get_tweets.php
Created January 23, 2012 10:05
Get a user's most recent tweets in PHP (including retweets, formatted mentions/hashtags and friendly dates)
<?php
/**
* Calculate the time elapsed from the timestamp described in the string
* and converts into a human-readable version (e.g. "about 3 days ago").
*/
function how_long_ago($date) {
$ago = false;
$elapsed = time() - strtotime($date);
if ($elapsed <= 1) {
@cecilemuller
cecilemuller / scene.wrl
Created January 25, 2012 16:56
Add `CTRL + Click` to display the name and tree of object(s) you clicked using `Browser.mouseSelect`
#VRML V2.0 utf8
Inline{url "some_file.wrl"}
DEF mouse MouseSensor {}
DEF script Script {
eventIn SFVec2f position
eventIn SFBool click
directOutput TRUE
url "javascript:
@cecilemuller
cecilemuller / gist:1972787
Created March 4, 2012 12:28
Static template via a SCRIPT tag, using Jquery Templates
<!--
Works even without the "plus" extension of the Templates plugin.
http://github.com/nje/jquery-tmpl
-->
<script id="MyStaticTemplate" type="text/x-jquery-tmpl">
<div>Hello ${hello}</div>
</script>
<script>
@cecilemuller
cecilemuller / script.js
Created March 4, 2012 12:34
Dynamic template from an arbitrary string, using Jquery Templates
/**
* Dynamic template from an arbitrary string
* (which could be stored in an external file or even in a database).
*
* Works even without the "plus" extension of the Templates plugin.
* http://github.com/nje/jquery-tmpl
*/
var MyData = {hello: "world"};
$.template("MyInlineTemplate", "<div>Hello ${hello}</div>");
$.tmpl("MyInlineTemplate", MyData).appendTo("#contents");
@cecilemuller
cecilemuller / FragmentShader.wrl
Created March 4, 2012 13:30
Three ways to embed an HLSL shader in VRML/X3D
#VRML V2.0 utf8
Transform {
translation -4 2 0
children Shape {
appearance Appearance{
material Material{
diffuseColor 0 0 0
emissiveColor 1 1 1
}
@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: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 {