Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git reset --soft HEAD^ | |
git commit --amend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Centering a DIV */ | |
body { | |
text-align: center; | |
min-width: 600px; | |
} | |
#wrapper { | |
margin:0 auto; | |
width:600px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:p="http://www.springframework.org/schema/p" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | |
<bean id="router" class="your.domain.routing.FirstAvailableMatchRouter"> | |
<property name="routes"> | |
<list> | |
<bean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_options(options, extra_options) | |
(options.keys + extra_options.keys).uniq.each do |key| | |
merge = options[key] && extra_options[key] | |
if key == :conditions && merge | |
options[key] = merge_conditions(extra_options[key], options[key]) | |
elsif key == :include && merge | |
options[key] = merge_includes(options[key], extra_options[key]).uniq | |
else | |
options[key] = options[key] || extra_options[key] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module | |
def declare(decorator, *args) | |
orig_method_added = method(:method_added) | |
metaclass = (class << self; self end) | |
defined_methods = [] | |
metaclass.send(:define_method, :method_added) do |name| | |
orig_method_added.call(name) | |
defined_methods << name | |
end | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'dm-core' | |
require 'dm-core' | |
APP_ROOT = File.expand_path(File.dirname(__FILE__)) | |
# Database stuff | |
DataMapper.setup(:default, "sqlite3:#{APP_ROOT}/tezeta.db") | |
class User | |
include DataMapper::Resource | |
property :id, Integer, :serial => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
privat { | |
# Do we know that extension? | |
hangup unless @user = User.first(:extension => extension) | |
# Add to call log | |
@user.call_logs << CallLog.new(:type => 'incoming', :caller_id => callerid, :created_at => Time.now) | |
dial(@user.node) | |
@user.save | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$name = 'Joe'; | |
echo 'Hello ' . $name; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS `community_conditions`; | |
CREATE TABLE `community_conditions` ( | |
`id` char(36) NOT NULL, | |
`condition_id` char(36) NOT NULL, | |
`community_id` char(36) NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `doc` (`condition_id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; |