Skip to content

Instantly share code, notes, and snippets.

View skwi's full-sized avatar
👥
N1que les clones

Cédric skwi

👥
N1que les clones
View GitHub Profile
@skwi
skwi / keybase.md
Created July 17, 2017 11:45
Keybase claim

Keybase proof

I hereby claim:

  • I am skwi on github.
  • I am skwi (https://keybase.io/skwi) on keybase.
  • I have a public key ASCSZ4ZFmFM81IluDcO-QFo0AgLoxFMH7nPbH9kQH4OxYgo

To claim this, I am signing this object:

@skwi
skwi / pre-commit
Created June 11, 2014 07:11
PHP pre-commit
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
@skwi
skwi / gist:6006164
Last active December 19, 2015 19:28
Load jQuery from Google API, minified in environments other than dev
<script
type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery{{ app.environment == 'dev' ? null : '.min' }}.js">
</script>
@skwi
skwi / roleSpecificBehavior.php
Created April 18, 2013 13:35
Symfony role specific behavor without elseif
public function myfunction() {
switch(true) {
case $this->securityContext->isGranted('ROLE_1'){
#code
break;
case $this->securityContext->isGranted('ROLE_2'){
#code
break;
case $this->securityContext->isGranted('ROLE_3'){
#code
{
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/Dayle Rees Color Schemes/Goldfish.tmTheme",
"detect_slow_plugins": false,
"drag_text": false,
"fade_fold_buttons": false,
"file_exclude_patterns":
[
"app/cache",
var confirmOnLeave = function(msg) {
window.onbeforeunload = function (e) {
e = e || window.event;
msg = msg || '';
// For IE and Firefox
if (e) {e.returnValue = msg;}
// For Chrome and Safari
@skwi
skwi / generatePassword.php
Last active December 15, 2015 13:48
Password generator
/**
* Generates a random Password
*
* @param integer $length The password length (8 characters default)
* @return string The password
*/
private function randomPassword($length = 8)
{
$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
@skwi
skwi / rmv-special-chars
Created November 23, 2012 09:10
remove html special chars
$__string__ = preg_replace("/&#?[a-z0-9]{2,8};/i","",$__string__);
@skwi
skwi / st_cheat.txt
Created April 23, 2012 08:30 — forked from bjhess/st_cheat.txt
Sublime Text Cheatsheet
Navigation:
cmd-p Goto Anything ('@' for functions, ':' for line number)
cmd-r Function finder
ctl-g Goto line number
cmd-sft-p Command palette
cmd-sft-f Find in Files
cmd-opt-r Toggle regex when finding
cmd-opt-# Columns
ctr-# Switch columns
@skwi
skwi / gist:2414507
Created April 18, 2012 15:57
Récupérer une IP avec ou sans proxy
$ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];