Skip to content

Instantly share code, notes, and snippets.

View ManUtopiK's full-sized avatar
:octocat:
Ready to code.

Emmanuel Salomon ManUtopiK

:octocat:
Ready to code.
View GitHub Profile
@ManUtopiK
ManUtopiK / gist:51928af258b06e1b3290
Last active August 29, 2015 14:13
Format french phone number
/**
* Format french phone number
* @param [string] $tel Phone number to format
* @return string Conventional human readable phone number
*/
function FormatTel($tel) {
$t = ereg_replace("[^0-9]", "", $tel);
if (strlen($t) === 10) {
return substr(chunk_split($t, 2, " "), 0, -1);
} else if (preg_match('/^\(?\+?33/', $tel)) {
@ManUtopiK
ManUtopiK / FireFTPtoBBEdit.command
Created May 24, 2012 05:38
Open BBEdit with fireFTP
#!/bin/sh
xattr -d com.apple.quarantine $1
open -b com.barebones.bbedit $1
@ManUtopiK
ManUtopiK / AppleScript
Created May 24, 2012 05:16
Open TotalTerminal on the current folder
on run
tell application "Finder"
try
activate
set frontWin to folder of front window as string
set frontWinPath to (get POSIX path of frontWin)
tell application "Terminal"
activate
tell application "System Events"
keystroke "`" using {control down} -- bring down visor
@ManUtopiK
ManUtopiK / gist:6707223
Created September 25, 2013 22:46
.gitignore generic
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
@ManUtopiK
ManUtopiK / gist:6926692
Created October 10, 2013 22:38
vanilla js
<script>
// custom lightweight selector implementation
// nickname: dolla
window.$ = function(selector) {
return document.querySelector(selector);
};
window.$$ = function(selector) {
@ManUtopiK
ManUtopiK / gist:6926869
Last active December 25, 2015 05:49
push/unshift - add an element to the end/beginning of an array | pop/shift - remove and return the last/first element of and array
     | add | remove | start | end

---------|:---:|:------:|:-----:|:----: push | X | | | X pop | | X | | X unshift | X | | X | shift | | X | X |

/*global $*/
// a temp value to cache *what* we're about to show
var target = null;
// collect all the tabs
var tabs = $('.tab').on('click', function () {
console.log('click');
target = $(this.hash).removeAttr('id');
if (location.hash === this.hash) {
@ManUtopiK
ManUtopiK / README.md
Created June 3, 2016 12:35 — forked from rowanmanning/README.md
Writing a Friendly README. This a companion-gist to the post: http://rowanmanning.com/posts/writing-a-friendly-readme/
@ManUtopiK
ManUtopiK / .gitignore
Last active August 10, 2016 22:00
.gitignore
#### Uncomment next line in case you must NOT version this .gitignore file :
#/.gitignore
#### Composer related
/vendor/*
/composer.phar
/composer
## Dependency directory
## Commenting this out is preferred by some people, see
@ManUtopiK
ManUtopiK / broken-image.css
Last active September 10, 2016 23:28
Beautiful placeholder for broken image
/* Adding Helpful Information */
img {
font-family: 'Helvetica';
font-weight: 300;
line-height: 2;
text-align: center;
width: 100%;
height: auto;