Skip to content

Instantly share code, notes, and snippets.

View x4d3's full-sized avatar

Xavier Delamotte x4d3

View GitHub Profile
@x4d3
x4d3 / DtoJsonStringHelper.java
Created October 15, 2015 16:49
a proposition of a DtoJsonStringHelper
public class DtoJsonStringHelper {
private DtoJsonStringHelper() {
}
private static final Gson GSON = new GsonBuilder()
.registerTypeAdapter(Optional.class, new GsonOptionalDeserializer())
.registerTypeAdapter(List.class, new GsonListDeserializer())
.create();
private static class GsonOptionalDeserializer implements JsonSerializer<Optional<?>> {
@x4d3
x4d3 / xml-returned-instead-of-json-when-validation-error.rb
Created January 28, 2016 14:08
Gist showing an issue with Xero API that returns xml instead of Json when there is a validation error
require 'rubygems'
require 'bundler/setup'
require 'xero_gateway'
YOUR_OAUTH_CONSUMER_KEY = ''
YOUR_OAUTH_CONSUMER_SECRET = ''
PATH_TO_YOUR_PRIVATE_KEY = 'privatekey.pem'
url = "https://api.xero.com/payroll.xro/1.0/Employees"
options = {
{
"organizations": [
"org-mno"
],
"hist_parameters": {
"from": "2015-08-01",
"to": "2015-09-29",
"period": "MONTHLY"
},
"dates": [
{
"organizations": [
"org-mno"
],
"hist_parameters": {"from": "2015-08-01", "to": "2015-09-29", "period": "MONTHLY"},
"dates": [
"2015-08-31",
"2015-09-29"
],
"account_list": [
@x4d3
x4d3 / message-wei
Last active February 17, 2017 16:09
Bonjour Xavier, je m'appelle Théo Levresse et je suis le Président du WEI de la P2019.
Si je te contacte, en tant qu'ancien membre et connaisseur de cette association, c'est pour t'inviter le 20 Mai 2017 à la journée d'adieu du campus de Châtenay.
Cette journée est l'occasion de se retrouver pour partager nos souvenirs des différents WEI sur le campus de Chatenay en tant qu'ancien du WEI ou autre.
Pour te faire une meilleure idée du projet, tu peux consulter et t'inscrire sur le site de l'événement : http://www.adieuchatenaybonjoursaclay.com
Tu peux aussi regarder les premiers teasers de la journée sur notre chaîne Youtube : https://www.youtube.com/channel/UCbdSn6R1Ss0CgUkCcIb47aQ
Nous aimerions faire de cette journée un grand rassemblement convivial intergénérationnel avec au programme et compris dans le prix de la journée : des conférences, des navettes vers Saclay, des rencontres sportives, des foodtrucks, un direct NX, des concerts, un cocktail dinatoire, un feu d'artifice et une dernière soirée à la N
@x4d3
x4d3 / GetReverses.java
Last active May 24, 2017 11:27
English reverse
public class GetReverses {
public static void main(String[] args) throws IOException {
Set<String> words = new HashSet<>();
InputStream is = GetReverses.class.getResourceAsStream("/words.txt");
try (Scanner sc = new Scanner(is, "UTF-8")) {
while (sc.hasNext()) {
String line = sc.nextLine();
if (line.length() <3){
continue;
{
"title": "A registration form",
"description": "A simple form example.",
"type": "object",
"required": [
"firstName",
"lastName"
],
"properties": {
"firstName": {
@x4d3
x4d3 / stopwatch.rb
Last active October 25, 2018 13:10 — forked from ikenna/stopwatch.rb
Simple Ruby stopwatch
class Stopwatch
def initialize
@start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
def elapsed_time
Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start_time
end
end
@x4d3
x4d3 / MARKDOWN.md
Last active October 26, 2018 10:08

collapsible markdown?

Coucou in `Test`
       ================================================================================
       An HTTP request has been made that VCR does not know how to handle:
         GET https://api.dpdgroup.co.uk/organisation/pickuplocation?countryCode=GB&filter=nearAddress&maxDistance=30&searchAddress=EC1Y%208AF&searchCriteria=&searchPage=1&searchPageSize=5
   VCR is currently using the following cassette:
  • /home/fm/spec/fixtures/vcr_cassettes/features/checkout/click_and_collect_within_uk_spec/uk_guest_ship_to_shop_checkout_using_new_address_for_recipient.yml