Skip to content

Instantly share code, notes, and snippets.

View bastienrobert's full-sized avatar
🎲
728

Bastien Robert bastienrobert

🎲
728
View GitHub Profile

Keybase proof

I hereby claim:

  • I am bastienrobert on github.
  • I am bastienrbt (https://keybase.io/bastienrbt) on keybase.
  • I have a public key whose fingerprint is E402 5515 5E15 E474 73D5 9B59 4179 CC7C 3F39 3545

To claim this, I am signing this object:

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}a{text-decoration:none}
@bastienrobert
bastienrobert / alphabet.js
Created June 23, 2017 12:54
Alphabet generator in Javascript
// Function to generate an array w/ alphabet letters
function genCharArray(charA, charZ) {
var a = [], i = charA.charCodeAt(0), j = charZ.charCodeAt(0);
for (; i <= j; ++i) {
a.push(String.fromCharCode(i));
}
return a;
}
// Function to parse URL and get last element
function parseURL(url) {
require 'uri'
require 'net/http'
require 'json'
url = URI("http://api.stanleystella.com/webrequest/products/get_json")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
Verifying that "bastienrobert.id" is my Blockstack ID. https://onename.com/bastienrobert
@bastienrobert
bastienrobert / URL_helper.rb
Created September 6, 2017 22:53
URL helper for middleman : translate the same page in another language
module URLHelper
def link_translate(lang)
return link_to data.languages.send(lang.to_s),
if lang === I18n.default_locale
config[:host] + '/' +
path_translate(lang) +
t("paths.#{current_page.data.title}", locale: lang)
else
config[:host] + '/' +
@bastienrobert
bastienrobert / gulpfile.js
Created October 1, 2017 11:28
Gulpfile using SASS and SASS-GLOB (from /scss to /css)
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var sassGlob = require('gulp-sass-glob');
gulp.task('scss', function () {
return gulp.src('./scss/app.scss')
.pipe(sassGlob())
.pipe(sass().on('error', sass.logError))
@bastienrobert
bastienrobert / parallax.js
Created October 10, 2017 12:23
Parallax library
/*
* Add a dataset to your target like this :
* data-parallax='1'
*
* Parallax strenght can be define with the number
*
*/
var els = []
@bastienrobert
bastienrobert / .htaccess
Last active October 31, 2017 13:35
Add password on your Apache server
AuthName "Secured page"
AuthType Basic
AuthUserFile "/var/www/.htpasswd"
Require valid-user
@bastienrobert
bastienrobert / slug_helper.rb
Created November 3, 2017 16:33
Old TradFood slug helper (text parametized)
module SlugHelper
def slugify(text)
return text.parameterize
end
def unslugify(slug)
return slug.tr('-', ' ')
end
end