Skip to content

Instantly share code, notes, and snippets.

View SANGED's full-sized avatar

m SANGED

  • @sublimetextpackages
View GitHub Profile
@SANGED
SANGED / repo-reset.md
Created February 28, 2019 21:07 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@SANGED
SANGED / supervisord.sh
Created February 9, 2019 13:45 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@SANGED
SANGED / vagrant-cheat-sheet.md
Created January 11, 2019 08:38 — forked from wpscholar/vagrant-cheat-sheet.md
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
function InsertOrNot($BD){ // Permet de savoir si oui ou non, un truc a ete inserer dans la base de donnees ou pas!
$stmt = $BD->query("SELECT LAST_INSERT_ID()");
$lastId = $stmt->fetch(PDO::FETCH_NUM);
$lastId = $lastId[0];
if($lastId>0){
echo "<center><i class=\"green\"><i class=\"fa fa-check\"></i> Op&eacute;ration &eacute;ffectu&eacute;e<i></center>";
}else{
echo "<center><i class=\"red\"><i class=\"fa fa-times\"></i>Erreur d&eacute;tect&eacute;e<i></center>";
}
@SANGED
SANGED / Multiple ReCaptcha on the same page
Created September 12, 2017 10:31 — forked from Sanix-Darker/[HTML - JS - PHP] Multiple ReCaptcha on the same page
Google normaly don't permit to do a multiple Recaptcha on the same page, so there is a way to sole this issue!
<?php
require 'recaptchalib.php';
$siteKey = 'XXXXXXXXXXXXXXXXXXXXXX'; // votre clé publique
$secret = 'XXXXXXXXXXXXXXXXXXXXXX'; // votre clé privée
?>
<form>
....
<div class="g-recaptcha" id="Optional-id"></div>
</form>