Skip to content

Instantly share code, notes, and snippets.

View rfrancillette's full-sized avatar

Rémy Francillette rfrancillette

View GitHub Profile
var brolly = new Image();
brolly.src = "brolly.gif";
canvas_context.shadowColor = "rgba( 0, 0, 0, 0.3 )";
canvas_context.shadowOffsetX = 6;
canvas_context.shadowOffsetY = 6;
canvas_context.shadowBlur = 3;
canvas_context.drawImage( brolly, 25, 250 );
@rfrancillette
rfrancillette / new_gist_file.html
Created September 27, 2013 12:23
Minimal HTML5 file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<!-- page content -->
ng-class="{true:'selected', false:''}[$index==selectedIndex]"
ng-class="{selected: $index==selectedIndex}"
ng-class="{admin:'enabled', moderator:'disabled', '':'hidden'}[user.role]"
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
package sandbox;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
import java.io.IOException;
import java.nio.file.ClosedWatchServiceException;
import java.nio.file.FileSystem;
package dynamic.proxy;
public class BirdFeather implements Feather {
@Override
public void color(String s) {
System.out.println("The color of the feather is : " + s);
}
}
@rfrancillette
rfrancillette / new_gist_file
Created June 13, 2013 09:48
Sous requêtes avec criteria hibernate
DetachedCriteria ownerCriteria = DetachedCriteria.forClass(Owner.class);
ownerCriteria.setProjection(Property.forName("id"));
ownerCriteria.add(Restrictions.eq("ownername", "bob"));
Criteria criteria = getSession().createCriteria(Pet.class);
criteria.add(Property.forName("ownerId").in(ownerCriteria));
@rfrancillette
rfrancillette / directives.js
Created June 11, 2013 13:28
Angularjs directive to select a file (drop or input file)
'use strict';
/* Directives */
angular.module('myApp.directives', []).
directive('file', function(){
return {
scope: {
file: '=data'
},
import java.util.ArrayList;
import java.util.List;
public class MyTree<T> {
public class Node<T> {
private T data;
private Node<T> parent;
private List<Node<T>> children;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.lang.reflect.Array;
public class Permute implements Iterator {
private final int size;
private final Object [] elements; // copy of original 0 .. size-1
private final Object ar; // array for output, 0 .. size-1
private final int [] permutation; // perm of nums 1..size, perm[0]=0