Skip to content

Instantly share code, notes, and snippets.

View terox's full-sized avatar
🎯
Focusing

David Pérez Terol terox

🎯
Focusing
View GitHub Profile
@baranovxyz
baranovxyz / Map.vue
Last active October 30, 2021 13:46
Example of using datamaps with vuejs
<template>
<div class="map" :style="`height: ${height}px;`">
<svg ref="svg" class="map-container"
xmlns="http://www.w3.org/2000/svg"
:width="width" :height="height"
shape-rendering="geometricPrecision"
:viewBox="`500 100 200 400`"
>
</svg>
</div>
@fulv
fulv / main.yml
Last active August 31, 2023 09:06
Ansible - Creating users and copying ssh keypair files to the remote server
Put this in your `local-configure.yml` file, add as many users as you need:
users:
- name: fulvio
sudoer: yes
auth_key: ssh-rsa blahblahblahsomekey this is actually the public key in cleartext
- name: plone_buildout
group: plone_group
sudoer: no
auth_key: ssh-rsa blahblahblah ansible-generated on default
@jehaby
jehaby / README.md
Last active January 25, 2024 14:43 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@Nickology
Nickology / array_merge_recursive_numeric()
Last active August 1, 2021 17:17
[PHP] Merge N arrays AND sum numeric values of identical keys
<?php
/**
* array_merge_recursive_numeric function. Merges N arrays into one array AND sums the values of identical keys.
* WARNING: If keys have values of different types, the latter values replace the previous ones.
*
* Example:
*
* $a = array( "A" => "bob", "sum" => 10, "C" => array("x","y","z" => 50) );
* $b = array( "A" => "max", "sum" => 12, "C" => array("x","y","z" => 45) );
* $c = array( "A" => "tom", "sum" => 8, "C" => array("x","y","z" => 50, "w" => 1) );
# supervisor
#
# Author: Günter Grodotzki <gunter@grodotzki.co.za>
# Version: 2015-04-25
#
# - set param "SUPERVISE=enable" to activate
# - chmod +x supervise.sh
#
packages:
yum:
@jsdf
jsdf / ReactNativeRefreshableListView.js
Last active September 15, 2023 07:29
React Native pull down to refresh ListView
// for an updated version see https://github.com/jsdf/react-native-refreshable-listview
var React = require('react-native')
var {
ListView,
ActivityIndicatorIOS,
StyleSheet,
View,
Text,
} = React
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@mickaelandrieu
mickaelandrieu / RedirectToAdminZoneListener.php
Last active February 23, 2017 10:51
Redirect to another action, regarding to the role (Symfony)
<?php
namespace AppBundle\EventListener;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Routing\Router;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
@drkarl
drkarl / gist:739a864b3275e901d317
Last active October 17, 2023 10:43
Ask HN: Best Linux server backup system?

Linux Backup Solutions

I've been looking for the best Linux backup system, and also reading lots of HN comments.

Instead of putting pros and cons of every backup system I'll just list some deal-breakers which would disqualify them.

Also I would like that you, the HN community, would add more deal breakers for these or other backup systems if you know some more and at the same time, if you have data to disprove some of the deal-breakers listed here (benchmarks, info about something being true for older releases but is fixed on newer releases), please share it so that I can edit this list accordingly.

  • It has a lot of management overhead and that's a problem if you don't have time for a full time backup administrator.
@xsist10
xsist10 / Dispatch1.php
Last active January 21, 2017 17:28
An event dispatcher in a tweet
<?php
// Version 1
// Minified
// class Dispatch{function add($e,$l){$this->l[$e][]=$l;}function trigger($e,$d){foreach ($this->l[$e] as $l)call_user_func_array($l, $d);}}
class Dispatch{
function add($e, $l) {
$this->l[$e][] = $l;