Skip to content

Instantly share code, notes, and snippets.

m SANGED

  • @sublimetextpackages
Block or report user

Report or block SANGED

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SANGED
SANGED / repo-reset.md
Created Feb 28, 2019 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands
View repo-reset.md

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 Feb 9, 2019 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
View supervisord.sh
#! /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.
View vagrant-cheat-sheet.md

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)
View [PHP] Simples amazing PHP fonctions
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 Google normaly don't permit to do a multiple Recaptcha on the same page, so there is a way to sole this issue!
View Multiple ReCaptcha on the same page
<?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>
You can’t perform that action at this time.