Skip to content

Instantly share code, notes, and snippets.

View ScullWM's full-sized avatar
🌶️
Caramba! PepperReport.io!

Thomas P ScullWM

🌶️
Caramba! PepperReport.io!
View GitHub Profile
@ScullWM
ScullWM / symfony.conf
Created June 19, 2018 15:16
debug_api_mirror
server {
server_name symfony.localhost;
root /var/www/symfony/public;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
@ScullWM
ScullWM / install.sh
Last active April 4, 2018 19:34
linux install golang - 1.10
curl -O https://dl.google.com/go/go1.10.linux-amd64.tar.gz
tar -xvf go1.10.linux-amd64.tar.gz
mv go /usr/local
apt-get install nano
nano ~/.profile
#export PATH=$PATH:/usr/local/go/bin
source ~/.profile
@ScullWM
ScullWM / open.php
Last active September 4, 2017 18:53
<?php
echo '<h1>Coucou</h1>';
@ScullWM
ScullWM / CommandBusMock.php
Created July 10, 2017 08:30
Mock Asynch bus
<?php
namespace Xeonys\Tests\Features\Mock;
use Rezzza\CommandBus\Domain\CommandBusInterface;
use Rezzza\CommandBus\Domain\CommandInterface;
class CommandBusMock implements CommandBusInterface
{
const FILENAME = 'async_queue';
foreach (debug_backtrace() as $debug) {
echo $debug['class'] . '::' . $debug['function'].'<br>';
}
exit();
package main
import (
"fmt"
"github.com/gorilla/securecookie"
"golang.org/x/crypto/bcrypt"
"log"
"net/http"
"time"
)
@ScullWM
ScullWM / auth.go
Last active November 28, 2016 23:24
func identifyUserFromForm(r *http.Request) User {
err := r.ParseForm()
email := r.Form.Get("email")
password := r.Form.Get("password")
du := User{}
u, err := du.FindOneUserByEmail(email)
if err != nil {
log.Fatal(err)
const cookieName = "mycookiename"
var hashKey = []byte(securecookie.GenerateRandomKey(32))
var blockKey = []byte(securecookie.GenerateRandomKey(32))
var sc = securecookie.New(hashKey, blockKey)
func ReadCookieHandler(r *http.Request) bool {
if cookie, err := r.Cookie(cookieName); err == nil {
value := make(map[string]string)
func checkAuth(h http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if ReadCookieHandler(r) {
h.ServeHTTP(w, r)
} else {
log.Printf("Not authorized %s", 401)
}
h.ServeHTTP(w, r)
}
var MyModalConfirmation = {
myModalStringSelector: '#myModal',
hashConfirmationModal: null,
confirmationMessage: 'Certain ?',
form: null,
saveBtn: null,
isConfirmed: false,