Skip to content

Instantly share code, notes, and snippets.

View ldonnet's full-sized avatar

Luc Donnet ldonnet

View GitHub Profile
@ldonnet
ldonnet / example.xml
Created October 17, 2018 14:29
Requête exemple
<samlp:LogoutRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="[RANDOM ID]"
Version="2.0"
IssueInstant="[CURRENT DATE/TIME]">
<saml:NameID>@NOT_USED@</saml:NameID>
<samlp:SessionIndex>[SESSION IDENTIFIER]</samlp:SessionIndex>
</samlp:LogoutRequest>
@ldonnet
ldonnet / web-fonts-asset-pipeline.md
Created February 23, 2016 20:35 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
/* Copyright Pierre GIRAUD, https://gist.github.com/pgiraud/6131715
* Published under WTFPL license. */
/**
* @requires OpenLayers/Renderer/SVG.js
*/
OpenLayers.Renderer.SVGExtended = OpenLayers.Class(OpenLayers.Renderer.SVG, {
eraseGeometry: function(geometry, featureId) {
this.removeArrows(geometry);
@ldonnet
ldonnet / ruby_method_caller.rb
Created December 5, 2014 10:42
Get method caller
def caller_method_name
parse_caller(caller(2).first).last
end
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = Regexp.last_match[1]
line = Regexp.last_match[2].to_i
method = Regexp.last_match[3]
[file, line, method]
@ldonnet
ldonnet / gist:2e75f3efa06d2e4631fa
Last active August 29, 2015 14:04 — forked from catalogchoice/gist:934418
Coffeescript namespace
namespace = (target, name, block) ->
[target, name, block] = [(if typeof exports isnt 'undefined' then exports else window), arguments...] if arguments.length < 3
top = target
target = target[item] or= {} for item in name.split '.'
block target, top
# https://github.com/jashkenas/coffeescript/wiki/FAQ
# http://blog.markhorgan.com/?p=505
# Usage:
#
@ldonnet
ldonnet / fiddle.css
Created July 9, 2014 08:07
D3JS + Openlayers polygons
body {
font-family: Arial, Helvetica, sans-serif;
}
#map {
margin: 0;
width: 960px;
height: 500px;
}
path {
fill: #000;
@ldonnet
ldonnet / fiddle.css
Last active August 29, 2015 14:03 — forked from mbertrand/index.html
D3JS + Openlayers points
body, html, #map {
font-family: Arial, Helvetica, sans-serif;
margin: 0;
width: 100%;
height: 100%;
}
path {
fill: #000;
fill-opacity: .2;
stroke: #fff;

become active record migration expert (Rails 4.0.2)

workflow:

create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
#
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
#