Skip to content

Instantly share code, notes, and snippets.

View mr-wildcard's full-sized avatar

Julien Viala mr-wildcard

  • Shine
  • Bordeaux, France
View GitHub Profile
@mixonic
mixonic / .gitignore
Created May 16, 2011 18:55
Mousy - A shared cursor for webpages using Node.js
node_modules
public/socket.io.min.js
public/jquery.js
@jimjeffers
jimjeffers / html5VideoAspectRatioAdjustment.coffee
Created September 15, 2011 13:24
Breaking the HTML5 Video Aspect Ratio
# Just an example.
# @video is a direct reference to a '<video>' element.
# $() is assuming jQuery is being used in this example.
@video.addEventListener("loadedmetadata", (event) =>
actualRatio = @video.videoWidth/@video.videoHeight
targetRatio = $(@video).width()/$(@video).height()
adjustmentRatio = targetRatio/actualRatio
$(@video).css("-webkit-transform","scaleX(#{adjustmentRatio})")
)
@gre
gre / easing.js
Last active June 27, 2024 15:37
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@jafstar
jafstar / adobe.html
Created August 19, 2012 15:44
HTML5 Image Progress Events
<html>
<head>
<script>
var request;
var progressBar;
function loadImage(imageURI)
{
request = new XMLHttpRequest();
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
@balupton
balupton / cors.js
Created September 11, 2012 05:21
Acheiving CORS via a Node HTTP Server
// Create our server
var server;
server = http.createServer(function(req,res){
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', '*');
if ( req.method === 'OPTIONS' ) {
res.writeHead(200);
@donovanh
donovanh / Animation & text mixins
Created April 20, 2013 16:56
Mixins for SASS including: - Animation - Keyframes - Text fill/stroke
/* Mixins to extend what Compass provides */
=animation($values...)
-webkit-animation: $values
-moz-animation: $values
-o-animation: $values
-ms-animation: $values
animation: $values
=keyframes($name)
/** @jsx React.DOM */
var MyRootComponent = React.createClass({
getInitialState: function() {
return {perMinute: '-', perDay: '-'};
},
componentDidMount: function() {
var socket = io.connect(this.props.url);
socket.on('business.clickout', this.setState.bind(this));
},
render: function() {
@shengt
shengt / variables.styl
Created February 27, 2014 21:21
Media queries variables for stylus
// Media queries breakpoints
// --------------------------------------------------
// Extra small screen / phone
$screen-xs ?= 480px
$screen-phone ?= $screen-xs
// Small screen / tablet
$screen-sm ?= 768px
$screen-tablet ?= $screen-sm
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {