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 / _extensions.js
Created March 4, 2012 12:53
Extend Bing Maps AJAX 6.3 to create pushpins, polylines and polygons easily
/**
* VEMap.CreatePushpin(point, options) and similar functions
* to create advanced pins, polylines & polygons easily in Bing Maps.
*/
function _addshapeoptions(scope_, type_, points_, options_){
var shape = new VEShape(type_, points_);
options_ = options_ || false;
if (options_){
for (var key in options_){
@cecilemuller
cecilemuller / _extensions.js
Created March 4, 2012 13:23
Touch support for Bing Maps 6.3 (e.g. for Iphone webapps)
/**
* Adds pan and zoom support for touch-based devices.
* Works best with fixed-size viewports, however VEMap.ZoomIn & VEMap.ZoomOut
* are very unreliable on the IPhone, you should keep the mini dashboard as a fallback.
*/
VEMap.prototype.EnableTouch = function(){
if (typeof Touch == "object"){
var map = this;
// Whether a gesture is being performed currently or not.
@cecilemuller
cecilemuller / _extensions.js
Created March 4, 2012 12:59
Animated pushpins in Bing Maps AJAX 6.3
/**
* This snipplet adds the following methods:
* VEMap.DropPushpin
* VEShapeLayer.DropPushpin
*
* This is similar to VEMap.AddPushpin except the pin is animated (it "falls" on the map).
*
* Works even in IE6 and the IPhone. Generic solution based on this proof of concept:
* http://www.garzilla.net/vemaps/DropPushPin.aspx
*/
@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
}