Skip to content

Instantly share code, notes, and snippets.

Avatar

Philippe Lhoste PhiLhoSoft

View GitHub Profile
@PhiLhoSoft
PhiLhoSoft / FizzBuzz.ceylon
Last active Aug 29, 2015
Ceylon functional FizzBuzz, two versions
View FizzBuzz.ceylon
shared void fizzBuzz()
{
print("## FizzBuzz 1 ##");
Iterable<String> fizzBuzz1(Integer count = 20)
{
return (1 .. count).map((Integer c) =>
15.divides(c) then "FizzBuzz" else
(3.divides(c) then "Fizz" else
(5.divides(c) then "Buzz" else c.string)));
}
@PhiLhoSoft
PhiLhoSoft / index.html
Created May 1, 2015
First application with Mithril
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Playing with Mithril</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Playing with <a href="http://lhorie.github.io/mithril/">Mithril</a></h1>
@PhiLhoSoft
PhiLhoSoft / ConvertGeoJsonToAdHocJson.js
Last active Aug 29, 2015
Convert (some kind of) GeoJson file to a (specific kind of) Json file, in SVG path format, using Node.js platform
View ConvertGeoJsonToAdHocJson.js
// Convert a limited / specific subset of GeoJson (the samples I had to convert...) to a specific Json format (for HighMaps),
// using the SVG path format.
// Made to run on the Node.js platform.
// Should accept more encodings, using a conversion library.
var fs = require('fs');
var arguments = process.argv;
//~ var inputFileName = __dirname + '/config.json';
var inputFileName = arguments[2], outputFileName, encoding;
@PhiLhoSoft
PhiLhoSoft / Lozenge.svg
Created Jun 18, 2015
Testing if Gists show a preview of SVG
View Lozenge.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PhiLhoSoft
PhiLhoSoft / ReadMe.md
Created Jun 23, 2015
Improving Most.js' Drag'n'Drop example
View ReadMe.md
View anchor.js
/* Anchor array: [ x, y, dx, dy ]
x, y (close of square): position on node, 0.0 to 1.0
dx, dy (end of arrows): direction, -1, 0 or 1
0,-1
^
|
+
0,0 0.5,0 1,0
+----------+
@PhiLhoSoft
PhiLhoSoft / BigCanvas
Last active Dec 13, 2015
BigCanvas: http://bigcanvas.frozenfractal.com My drawings. At least, they are mine at the time of referencing, they can be altered, defaced, obliterated, etc.
View BigCanvas
Small island with a palm tree, an ugly guy
http://bigcanvas.frozenfractal.com/#.Q,6,446,492
A shark
http://bigcanvas.frozenfractal.com/#AX,XO,56,17
Japanese skewer
http://bigcanvas.frozenfractal.com/#Dn,KG,324,389
Weight and hammer, mouse and bird
http://bigcanvas.frozenfractal.com/#a,l,240,492
Transform part of the big dashed line into a stair, and someone (?) climbing it
http://bigcanvas.frozenfractal.com/#.Oz,x,73,246
@PhiLhoSoft
PhiLhoSoft / AutomatedWriter.ahk
Last active Dec 14, 2015
AutoHotkey script to draw letters, digits and some punctuation characters with the mouse.Designed to draw on BigCanvas, but tested on Windows Paint and should work on any similar program.
View AutomatedWriter.ahk
/*
// by Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr
// File/Project history:
1.00.000 -- Today (PL) -- Lastest version (updated regularly!).
0.01.000 -- 2013/02/12 (PL) -- Creation.
*/
/* Copyright notice: For details, see the following file:
http://Phi.Lho.free.fr/softwares/PhiLhoSoft/PhiLhoSoftLicence.txt
This program is distributed under the zlib/libpng license.
Copyright (c) 2013 Philippe Lhoste / PhiLhoSoft
View atom-perforce.js
'use strict';
var atomPerforce = module, // sugary alias
path = require('path'),
os = require('os'),
p4 = require('node-perforce'),
Q = require('q'),
$ = require('jquery'),
environment = require('./environment'),
clientStatusBarElement = $('<div/>')
@PhiLhoSoft
PhiLhoSoft / showheaders.js
Created Aug 29, 2013
Minor changes from the showheaders.js found at http://bgrins.github.io/devtools-snippets/ Discovering some nice features...
View showheaders.js
// showheaders.js
// Little changes (for Firebug) from https://github.com/bgrins/devtools-snippets
// Print out response headers for current URL.
(function()
{
var request = new XMLHttpRequest();
request.open('HEAD', window.location, false);
request.send(null);