Skip to content

Instantly share code, notes, and snippets.

View bastienrobert's full-sized avatar
🎲
728

Bastien Robert bastienrobert

🎲
728
View GitHub Profile
@bastienrobert
bastienrobert / .htaccess
Created November 29, 2017 14:32
Remove .html from HTACCESS
#example.com/page will display the contents of example.com/page.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
@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
@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 / TECHS.md
Last active January 30, 2018 23:35
Technologies I already used

Technologies

Here are the techs I already used.

Legend

❤️ Mastered

... Doesn't mastered, but advanced utilisation

😕 Already used but doesn't mastered

@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 / 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 / README.md
Last active November 6, 2017 08:21
README markdown template
@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] + '/' +
Verifying that "bastienrobert.id" is my Blockstack ID. https://onename.com/bastienrobert
@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) {