Skip to content

Instantly share code, notes, and snippets.

Chargement de la page HTML à parser...
## Récupérer tous les liens par selecteur XPath
## //table[1]/tbody/tr/td[1]/a
user system total real
hpricot 17.630000 0.510000 18.140000 ( 21.813587)
nokogiri 2.700000 0.100000 2.800000 ( 3.076731)
## Récupérer une cellule du tableau spécifique par selecteur XPath
@pointcom
pointcom / Test with CURL
Created January 15, 2009 12:24
Serving rails page caches to a facebook POST request with nginx (error)
$ curl -X GET http://localhost:4000/page.html
Hello World
$ curl -X POST http://localhost:4000/page.html -d ""
<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx/0.6.34</center>
</body>
@pointcom
pointcom / nginx.conf
Created January 15, 2009 17:42
Patch for Nginx 0.6.34 : Added instruction "post_to_static" (HTTP 405 error when serving static file after a POST request)
server {
listen 80;
server_name my.host.com;
location / {
root /path/to/your/root;
post_to_static on; # You allow static file after a POST request
}
}
// Example of MPVolume which doesn't work on SDK 3.0
MPVolumeView *volumeView = [[MPVolumeView alloc] init];
[volumeView sizeToFit];
[self.view addSubview:volumeView];
[volumeView release];
var hash = document.location.hash.replace('#', '');
$('a[data-target='+hash+']').trigger('click');
@pointcom
pointcom / docker_install.sh
Last active August 29, 2015 14:22
OSX Docker Machine + Docker Compose + Docker Client + Use NFS instead of vboxsf for /Users dir
#!/bin/sh
# This Script aims to setup a docker environment for Linux or OSX with docker client, docker-machine and docker-compose
# All binaries are install in /usr/local/bin/ directory.
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
os=$(uname -s)
arch=$(uname -m)
@pointcom
pointcom / Dockerfile
Created October 7, 2017 16:17
Phoenix project dockerized
FROM elixir:1.5.0
WORKDIR /app
# Install Hex
RUN mix local.hex --force
# Install rebar3
# Needed to compile dependency :ranch
RUN mix local.rebar --force
@pointcom
pointcom / docker-tag-list.sh
Created November 26, 2017 21:19
List all the tags of a particular docker image
#!/bin/bash
i=0
while [ $? == 0 ]
do
i=$((i+1))
curl https://registry.hub.docker.com/v2/repositories/library/ruby/tags/?page=$i 2>/dev/null|jq '."results"[]["name"]'
done
@pointcom
pointcom / struct.rb
Last active January 2, 2018 13:46
Ruby 2.5
Customer = Struct.new(:name, :address, keyword_init: true)
Customer.new(name: "Dave", address: "123 Main")
#=> #<struct Customer name="Dave", address="123 Main">
# Before you had to use begin
lambda do
begin
raise 'err'
rescue
$! # => #<RuntimeError: err>
end
end.call
# Now you can simply use rescue