Skip to content

Instantly share code, notes, and snippets.

View danhper's full-sized avatar

Daniel Perez danhper

View GitHub Profile
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar require dg/twitter-php 3.3
@danhper
danhper / main.go
Created September 3, 2014 11:41
Tour of go #62.
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct {
data [][]uint8
<html>
<head>
<title>Error while compiling</title>
</head>
<body>
<div class="error">
<h1>Error while running newer:jade:dev</h1>
<h2>Jade failed to compile "views/index.jade".</h2>
<pre>Error: views/index.jade:3
// fix tab behavior
{ "keys": ["tab"], "command": "expand_abbreviation_by_tab","context": [
{ "operand": "source.css, source.sass, source.less, source.scss, source.stylus, text.xml, text.html, text.haml, text.scala.html, source string",
"operator": "equal", "match_all": true, "key": "selector"},
{ "operand": "text.html source.php, storage.type.templatetag.django", "operator": "not_equal", "match_all": true, "key": "selector" },
{ "match_all": true, "key": "selection_empty" },
{ "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
{ "operator": "equal", "operand": false, "match_all": true, "key": "setting.disable_tab_abbreviations" },
{ "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
{ "match_all": true, "key": "is_abbreviation" }]
require 'redcarpet'
class CustomMarkdownRenderer < Redcarpet::Render::Base
@section_opened = false
def header(text, header_level, options)
s = ''
if header_level == 1
s << "</div>\n" if @section_opened
s << "<div class=\"section\">\n<h1>"
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid /var/run/nginx.pid;
events {
@danhper
danhper / nginx
Created May 2, 2014 15:05
Nginx init script for Ubuntu 12.04 with Passenger
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
def make_sum_integers(f):
def inner_sum_integers(a, b):
if a > b:
return 0
else:
return a + f(f)(a + 1, b)
return inner_sum_integers
def sum_integers(a, b):
return make_sum_integers(make_sum_integers)(a, b)
@danhper
danhper / Main.java
Created March 28, 2014 05:49
opencsv sample usage
package com.tuvistavie.foo;
import java.io.Reader;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.IOException;
import au.com.bytecode.opencsv.CSVReader;
public class Main {
public static void main(String[] args) throws IOException {
package com.example.customlistview;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;