Skip to content

Instantly share code, notes, and snippets.

View ramingar's full-sized avatar
:octocat:
Not a PRO user

Rafael Minguet ramingar

:octocat:
Not a PRO user
View GitHub Profile
@ramingar
ramingar / redis-data-types-string.md
Last active August 29, 2015 14:23
Redis data types (string) #redis #comandos #string
> set mykey somevalue
OK
> get mykey
"somevalue"

Multiple set o get (MSET and MGET commands) (for reduced latency):

> mset a 10 b 20 c 30
@ramingar
ramingar / redis-data-types-lists.md
Last active August 29, 2015 14:23
Redis data types (lists) #redis #comandos #lists

LPUSH (adds on the left (at the head)), RPUSH (on the right (at the tail)), LRANGE (extracts ranges of elements from lists). Note that LRANGE takes two indexes, the first and the last element of the range to return. Both the indexes can be negative, telling Redis to start counting from the end: so -1 is the last element, -2 is the penultimate element of the list, and so forth.:

> rpush mylist A
(integer) 1
> rpush mylist B
(integer) 2
> lpush mylist first
(integer) 3
> lrange mylist 0 -1
@ramingar
ramingar / phonegap-remote-debug.md
Created July 3, 2015 23:36
Depurar phonegap en remoto #debug #phonegap #remoto
  • Arranca el servidor de phonegap
  • Entra en chrome y ves a about:inspect
@ramingar
ramingar / code-status-response-rest.md
Last active December 18, 2015 08:58
Códigos de respuesta después de una petición REST #rest #restful #status
  • 200: OK
  • 201: Created
  • 204: No content (Delete o Update)
  • 400: Bad Request (esperaba un Integer y le pasaste un String)
  • 401: Unauthorized (No autorizado)
  • 403: Forbidden
  • 404: Not found
  • 405: Method not allowed
@ramingar
ramingar / control-response-rest-angular.md
Last active August 29, 2015 14:27
Servicio de peticiones REST y control de la response de AngularJS 1.3+ #rest #restful #angularjs #angular #response
  /* Service */
  .factory('ServiceContainer', ['$resource', function($resource) {
    var defaultParams = {
      'page': 0,
      'size': 8
    };

    return {
      getResource: function (customParams) {
@ramingar
ramingar / css-wrap-line.md
Last active August 29, 2015 14:28
Puntos suspensivos al final de una línea #css #wrap #line

.wrapped-line { width: 2rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

@ramingar
ramingar / window-open-native-app.html
Last active August 26, 2015 07:49
Función para abrir una aplicación nativa desde phonegap #phonegap #angular #window #open #native #window.open
<script>
// At the controller:
$scope.redirectToSystemApp = function (url, protocol) {
if (typeof protocol == 'undefined') {
window.open(encodeURI(url), '_system', 'location=yes');
preventDefault();
} else {
window.open(protocol + ':' + url, '_system');
}
};
@ramingar
ramingar / name-of-server.conf
Last active September 16, 2021 10:58
Configuración de virtual host para usar el patrón bootstrap #vhost #virtualhost #bootstrap #apache
# Para que el servidor no te muestre un error de 'You don't have permission to access / on this server' necesitas comentar o eliminar en apache2.conf estas líneas:
#<Directory />
# Options FollowSymLinks
# AllowOverride None
# Require all denied
#</Directory>
<VirtualHost *:80>
ServerName miweb.local
@ramingar
ramingar / move-another-remote-repo.migrate
Last active October 23, 2022 23:09
Cambiar de un repo remoto git a otro moviendo todos los commits, tags, etc. #git #remote
# Info seen at: https://gist.github.com/maakor/8972566
#
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
@ramingar
ramingar / regexp-date-validation.md
Last active September 17, 2015 07:39
Regexp para validar una fecha dd/MM/yyyy dd-MM-yyyy #regexp #date #validate

Credits to Ofir Luzon at http://stackoverflow.com/questions/15491894/regex-to-validate-date-format-dd-mm-yyyy

^(?:(?:31(/|-|.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(/|-|.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(/|-|.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(/|-|.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$