Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<style>
div {
width: 300px;
height: 200px;
float: left;
background-color: green;
border: 1px solid black;
margin: 2px;
import re
HTML_REMOVER = lambda html: re.compile(r'<.*?>').sub('', html)
assert HTML_REMOVER('<html><body>foo <strong>bar</strong></body></html>') == 'foo bar'
@pvalencia
pvalencia / .bashrc
Created May 20, 2010 02:50 — forked from henrik/.bashrc
function get_short_commit {
git log -n 1 --format=oneline --abbrev-commit 2> /dev/null | sed -e 's/\([0-9a-f]*\)\(.*\)/\1/'
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1 $(get_short_commit)]$(parse_git_dirty)/"
}
<?php
class DATABASE_CONFIG {
var $development = array(
'driver' => 'sqlite',
'persistent' => false,
'host' => '',
'login' => '',
'password' => '',
'database' => 'development.sqlite',
\documentclass[letterpaper,12pt]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%% PORTADA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1pt\hfill \kern \z@}
\renewcommand{\maketitle}{\begin{titlepage}%
\let\footnotesize\small
// ==UserScript==
// @name U-Cursos Slider Menu
// @namespace u-cursos
// @include https://www.u-cursos.cl/*
// ==/UserScript==
(function(){
GM_xmlhttpRequest({
method: "GET",
url: "http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js",
// ==UserScript==
// @name Esconder nuevos en instituciones
// @namespace u-cursos
// @include https://www.u-cursos.cl/*
// ==/UserScript==
nuevos = document.getElementById('instituciones').getElementsByClassName('nuevo');
for(el in nuevos) {
el = nuevos[el];
el.style.display = 'none';
}
@pvalencia
pvalencia / gist:169204
Created August 17, 2009 15:55
example for twitter-cakephp-component
<?php
class FooController extends AppController {
var $components = array('Twitter');
function bar() {
/* authentication */
$this->Twitter->username = 'foo';
$this->Twitter->password = 'bar';
$this->set('statuses',
/* Based on gist: 26061 by bastos. */
CmdUtils.CreateCommand({
names: ["code"],
icon: "http://www.github.com/favicon.ico",
author: {name: "Pedro Valencia", email: "pvalencia+github@gmail.com"},
license: "GPL",
homepage: "http://gist.github.com/gists/168442",
description: "Search on Github Code Search",
help: "Search on Github Code Search",
arguments: [{role: 'object', nountype: noun_arb_text, label: 'function'}],
@pvalencia
pvalencia / gist:167635
Created August 14, 2009 03:52
async but not ajax cross-site
<html>
<head></head>
<body>
<ul id="tweets">
</ul>
<a href="#">reload tweets</a>
<script src="jquery-1.3.2.min.js"></script>
<script>
function updateTwitter(tweets) {
var uls = '';