Skip to content

Instantly share code, notes, and snippets.

View dmouse's full-sized avatar
🏠
Working from home

David Flores dmouse

🏠
Working from home
View GitHub Profile
<?php
#
# Using PHP Web Scraper Goutte in a Console Task in a Silex project
#
# http://www.testically.org/2011/09/30/using-php-web-scraper-goutte-in-a-console-task-in-a-silex-project/
#
namespace Caefer;
@dmouse
dmouse / battery_nottify.sh
Created November 30, 2012 00:17
Notify my Android | battery charged | NMA
#!/bin/bash
acpi -b |\
grep Battery |\
awk '{
if ( int($4) >= 98 ) {
system("/usr/local/bin/nma Battery Charged \"Desconecta el pinche cargador\" 0 > /dev/null")
}
if ( int($4) < 10 ) {
system("/usr/local/bin/nma Battery Charged \"Conecta el pinche cargador\" 0 > /dev/null")
(function($){
$.randomages = {
defaults: {
path: 'images/',
images: ['image1.jpg','image2.jpg']
}
}
$.fn.extend({
@dmouse
dmouse / layout.html.twig
Last active December 14, 2015 11:29
Ejemplo de un layout en twig
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
{% block base %}{% endblock%}
</body>
</html>
@dmouse
dmouse / base.html.twig
Created March 4, 2013 02:54
layout base en twig
{% extends "layout.html.twig" %}
{% block base %}
<div id="header">
{% block header %} My WebPage {% endblock %}
</div>
<div id="content">
{% block content %}{% endblock %}
@dmouse
dmouse / content.html.twig
Created March 4, 2013 02:55
Ejemplo de un bloque en twig
{% extends "base.html.twig" %}
{% block content %}
contenido
{% endblock %}
{% extends "base.html.twig" %}
{% block aside %}
Aside
{% endblock %}
@dmouse
dmouse / index_dev.php
Created March 4, 2013 03:33
Ejemplo de uso de Silex
// web/index_dev.php
require_once __DIR__.'/../vendor/autoload.php';
//inicio de la aplicación
$app = new Silex\Application();
//Index
$app->match('/', function () {
@dmouse
dmouse / .bashrc
Created March 28, 2013 06:01
Bashrc + Drush + GIT Branches
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias dl='drush dl'
alias en='drush en'
alias dis='drush dis'
@dmouse
dmouse / query-solr.php
Created April 5, 2013 00:57
Create nested joins in apache solr with solarium. - This sample run with apache solr 4.x. - The nested querys is defined by the key _query_:" ... _query_:\" ... _query_:\" ... \" \" "
<?php
use \Solarium\Client as Client;
$config = array(
'endpoint' => array(
'localhost' => array(
'host' => '127.0.0.1',
'port' => 8080,
'path' => '/solr4/',