Skip to content

Instantly share code, notes, and snippets.

View thiphariel's full-sized avatar
💤

Thiph thiphariel

💤
  • 09:32 (UTC +02:00)
View GitHub Profile
@thiphariel
thiphariel / gplus.html
Created November 5, 2014 20:06
Google+ comments on Ghost
<section class="comments">
<div class="g-comments" data-href="{{@blog.url}}{{url}}" data-first_party_property="BLOGGER" data-view_type="FILTERED_POSTMOD">Loading Google+ Comments ...</div>
<script async type="text/javascript" src="//apis.google.com/js/plusone.js?callback=gpcb"></script>
<noscript>Please enable JavaScript to view the <a href="https://plus.google.com/">comments powered by Google+.</a></noscript>
</section>
@thiphariel
thiphariel / sftp.sh
Created December 11, 2014 11:07
Add user sftp permissions
useradd someuser
mkdir -p /home/someuser/www
mount --bind /var/www /home/someuser/www
chmod g+s /home/someuser/www
chown -R someuser:www-data /home/someuser/www
setfacl -d -m g::rwx /home/someuser/www
# In /etc/fstab file ...
/var/www /home/someuser/www none bind 0 0
@thiphariel
thiphariel / async.js
Created April 17, 2015 08:17
async loop javascript
var asyncEach = function(array, fn, callback, chunk, context) {
context = context || window;
chunk = chunk || 100;
var index = 0;
function process() {
var count = chunk;
while (count-- && index < array.length) {
// callback called with args (value, index, array)
fn.call(context, array[index], index, array);
@thiphariel
thiphariel / .jshintrc
Last active August 29, 2015 14:26 — forked from haschek/.jshintrc
JSHint Configuration, Strict Edition
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
@thiphariel
thiphariel / ghost-api.php
Created August 31, 2015 13:46
Retrieve ghost authentification token in PHP
<?php
// Fill the informations below with your own credentials
$domain = 'http://my-domain.com';
$data = array(
'grant_type' => "password",
'username' => "[MY_MAIL_ADDRESS]",
'password' => "[MY_PASSWORD]",
'client_id' => "ghost-admin"
);
@thiphariel
thiphariel / osmpbf.sh
Created September 16, 2015 15:15
OSM to PBF
#!/bin/bash
download_path=.
name=default
osmosis_path=../osmosis/bin
bbox=2.25151,46.96151,2.55981,47.19391
usage()
{
cat << EOF
@thiphariel
thiphariel / rebuild_icon_cache.bat
Created September 24, 2015 09:14
Rebuild icon cache on Windows 7/8
@echo off
set iconcache=%localappdata%\IconCache.db
echo The Explorer process must be killed to delete the Icon DB.
echo.
echo Please SAVE ALL OPEN WORK before continuing.
echo.
pause
echo.
If exist "%iconcache%" goto delID
@thiphariel
thiphariel / for-loops.js
Created October 13, 2015 14:58 — forked from juliocesar/for-loops.js
ES6 - for loops
// ES6 for loops
// =============
// Things in ES6 can be "iterable". Arrays are iterable by default.
var fruits = ['Apple', 'Banana', 'Grape'];
for (var fruit of fruits)
console.log('Fruit: ' + fruit);
@thiphariel
thiphariel / api-service.js
Created October 19, 2015 13:32
ES6 angular 1 service API
var api = ($q, $http, $log) => {
let get = (api, params) => {
let defered = $q.defer();
// Let's encode our params
for (let key of Object.keys(params)) {
params[key] = encodeURI(params[key]);
}
// Build our http request
export default function Component ({
restrict = "E",
replace = true,
scope = {},
bindToController = {},
controllerAs = "ctrl",
controller = () => {},
template = null,
link = () => {},
transclude = false