Skip to content

Instantly share code, notes, and snippets.

View donpadre's full-sized avatar
🏠
Working from home

MARIE-JOSEPH Olivier donpadre

🏠
Working from home
View GitHub Profile
@donpadre
donpadre / _notes.md
Created April 8, 2018 19:09 — forked from sgnl/_notes.md
AJAX with Vanilla Javascript. (XMLHttpRequest)

Short XHR Examples

Examples shown are bare minimum needed to achieve a simple goal.

Resources

  • Google Chrome's Dev Tools' Network Panel c-c-c-c-c-ULTIMATE c-c-c-COMBO!!!
  • requestb.in enpoints for your HTTP Requests as a free service.
@donpadre
donpadre / LoadUserData.php
Created March 31, 2018 09:47 — forked from jmather/LoadUserData.php
How to load users in a fixture
<?php
namespace Application\Sonata\UserBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Application\Sonata\UserBundle\Entity\User;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
@donpadre
donpadre / certificate.sh
Created January 16, 2018 10:42 — forked from WebReflection/certificate.sh
A basic Self Signed SSL Certificate utility
#!/usr/bin/env bash
# A basic Self Signed SSL Certificate utility
# by Andrea Giammarchi @WebReflection
# https://www.webreflection.co.uk/blog/2015/08/08/bringing-ssl-to-your-private-network
# # to make it executable and use it
# $ chmod +x certificate
# $ ./certificate # to read the how-to
@donpadre
donpadre / js-toSlug.js
Created December 11, 2017 23:05 — forked from juanmhidalgo/js-toSlug.js
JavaScript toSlug()
String.prototype.toSlug = function(){
st = this.toLowerCase();
st = st.replace(/[\u00C0-\u00C5]/ig,'a')
st = st.replace(/[\u00C8-\u00CB]/ig,'e')
st = st.replace(/[\u00CC-\u00CF]/ig,'i')
st = st.replace(/[\u00D2-\u00D6]/ig,'o')
st = st.replace(/[\u00D9-\u00DC]/ig,'u')
st = st.replace(/[\u00D1]/ig,'n')
st = st.replace(/[^a-z0-9 ]+/gi,'')
st = st.trim().replace(/ /g,'-');
@donpadre
donpadre / slugify.js
Created December 11, 2017 23:05 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
<style lang="sass" scoped>
.app {
position : relative;
width : 100vw;
height : 100vh;
margin : 0 !important;
}
.appbar {
position : absolute;
@donpadre
donpadre / app.js
Created July 21, 2017 12:26 — forked from Burke9077/app.js
OBS Node Controller app.js
// Init packages for server
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var fs = require('fs');
// Install robot
var robot = require("robotjs");
@donpadre
donpadre / jekyll-and-liquid.md
Created March 22, 2017 08:21 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@donpadre
donpadre / jekyll-json.rb
Created February 23, 2017 07:53 — forked from esmevane/jekyll-json.rb
[ Jekyll / Ruby / Json ]: Generate json out of Jekyll posts
require 'json'
module Jekyll
module JsonContent
class Index < Jekyll::Page
attr_reader :page
def initialize site, base, dir, page
@site = site
@donpadre
donpadre / favicon.sh
Created February 22, 2017 11:13 — forked from Phlow/favicon.sh
Favicon Generator: Generate favicons on Mac OSX via bash/shell with the help of sips command. Than optimize the images with ImageOptim (App)
#!/bin/sh
#
# Dieses Script fragt nach einer Bildatei, die dann in die
# verschiedenen Favicon-Größen mittels sips-Kommandos
# umgewandelt werden. Ist auf dem Rechner das Programm
# ImageOptim installiert, dann werden die Bilddateien
# anschließend verlustlos optimiert.
# Farben in Variablen schreiben (schönerer Output)
reset='\x1B[0m'