Skip to content

Instantly share code, notes, and snippets.

/* Hola mundo */
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hola mundo\n");
return 0;
}
vive en una pina debajo del mar!
BOB ES PON JA!
require 'thor'
module Gazette
class Application < Thor
desc "init", "Creates a new git managed blog in the current working directory"
def init
Application::Init.run
end # init
desc "post", "Post a new blog article"
require 'thor'
module Gazette
class Application < Thor
desc "init", "Creates a new git managed blog in the current working directory"
def init
Application::Init.run
end # init
desc "post", "Post a new blog article"
@cameroncox
cameroncox / gist:525
Created July 22, 2008 00:47
undefined
require 'thor'
module Gazette
class Application < Thor
desc "init", "Creates a new git managed blog in the current working directory"
def init
Application::Init.run
end # init
desc "post", "Post a new blog article"
@kastner
kastner / gist:545
Created July 22, 2008 01:00 — forked from anonymous/gist:543
Joe's meta-programing for testing private stuff in PHP
<?php
class Foo
{
protected $user = null;
public function __construct($user)
{
$this->user = $user;
}
class GemHelper # :nodoc:
include Singleton
attr_accessor :project
attr_accessor :package
attr_accessor :gem_name
attr_accessor :version
def initialize
self.project = "magrathea"
foreach($post_params as $key => $value) {
$sanitized_value = sanitize($value);
$regex = '/\<\$' . $key . '\>/';
$template_content = preg_replace($regex, $sanitized_value, $template_content);
}
// lol
# first we will give Domains a little help
class Domain < String
def subdomain( rank = 1 ) ; self.split('.')[0..(rank-1)].join('.') ; end
def level( rank ) ; self.split('.')[(rank*-1)..-1].join('.') ; end
def top_level ; level(1) ; end
end
# now we can treat them like strings but also access domain components naturally
@automatthew
automatthew / gist:569
Created July 22, 2008 01:22 — forked from dyoder/domain.rb
domain name class; QUESTIONABLE
# first we will give Domains a little help
class Domain < String
def subdomain( rank = 1 ) ; self.split('.')[0..(rank-1)].join('.') ; end
def level( rank ) ; self.split('.')[(rank*-1)..-1].join('.') ; end
def top_level ; level(1) ; end
end
# now we can treat them like strings but also access domain components naturally