Skip to content

Instantly share code, notes, and snippets.

View rayfranco's full-sized avatar

Franco Bouly rayfranco

View GitHub Profile

Keybase proof

I hereby claim:

  • I am rayfranco on github.
  • I am rayfranco (https://keybase.io/rayfranco) on keybase.
  • I have a public key ASBwJPA-nwT-9R65pbQGalDUaGvb_axj4DaN58MQbTVSVwo

To claim this, I am signing this object:

@rayfranco
rayfranco / .htaccess
Created January 25, 2018 17:57 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@rayfranco
rayfranco / common-characters.txt
Created January 31, 2018 17:24
Common characters to be used with Google Fonts (FR)
azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN<>,?!;.:/=+*$€£1234567890-_@#&'""`%()[]<>éèêçàùÉÈÊÇÀÙ
@rayfranco
rayfranco / README.md
Created April 7, 2014 23:42
Convert YML to JSON with gulp

Convert YML to JS with gulp

This was a very straightforward workaround I used in a project to get things done while the assemble team is working on some serious converter gulp-convert.

module.exports = (string) => {
return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
}
@rayfranco
rayfranco / SomeComponent.js
Created March 6, 2018 01:49
Autoload Vue components folder
import SubfolderComponents from './subfolder'
export default {
components: {
// This will add all components in subfolder
...SubfolderComponents
}
}
@rayfranco
rayfranco / checkStatus.js
Created June 21, 2018 15:03
Check for status code change periodically. Designed to be pasted in Chrome Dev Tools to bypass any CORS issues.
function check (DELAY_MINUTE = 1, RESPONSE_CODE = 200) {
var req = new XMLHttpRequest()
req.addEventListener('load', onLoad)
function open () {
req.open('HEAD', location.href, true)
req.send()
}
function onLoad () {
req.status === RESPONSE_CODE ? notify() : setTimeout(open, DELAY_MINUTE * 60 * 1000)
}
@rayfranco
rayfranco / GravatarExtension.php
Last active November 6, 2018 05:30
Twig extension filter that convert email into gravatar url, or secure gravatar url
<?php
// Acme\DemoBundle\Twig\GravatarExtension
namespace Acme\DemoBundle\Twig;
class GravatarExtension extends \Twig_Extension
{
private $secure_request = false;
var cushion = .5;
var length = 50;
var dx = point.x - mouse.x;
var dy = point.y - mouse.y;
var da = Math.sqrt(dx * dx + dy * dy);
// Tend à ramener la distance entre les segments à length
var ox = dx / da * length - dx;
var oy = dy / da * length - dy;
router.beforeEach((to, from, next) => {
const requiresAuth = to.matched.some(record => {
return record.meta.requiresAuth
})
if (requiresAuth && !store.$data.isRegistered) {
next('/login')
} else {
next()
}
})