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
# http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off | |
# Join Table: Simple Associations | |
# Table: | |
create_table "dancers_movies", :id => false do |t| | |
t.column "dancer_id", :integer, :null => false | |
t.column "movie_id", :integer, :null => false | |
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
<!doctype html> | |
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]--> | |
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]--> | |
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]--> | |
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> |
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" ?> | |
<rss version="2.0"> | |
<channel> | |
<title>RSS Title</title> | |
<description>This is an example of an RSS feed</description> | |
<link>http://www.someexamplerssdomain.com/main.html</link> | |
<lastBuildDate>Mon, 06 Sep 2010 00:01:00 +0000 </lastBuildDate> | |
<pubDate>Mon, 06 Sep 2009 16:45:00 +0000 </pubDate> | |
<item> |
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 | |
$my_query = new WP_Query('post_status=future&order=DESC&showposts=5'); | |
if ($my_query->have_posts()) { | |
while ($my_query->have_posts()) : $my_query->the_post(); ?> | |
<?php the_date(); ?> - <?php the_title(); ?> | |
<?php endwhile; | |
} | |
// Source: http://www.studionashvegas.com/tutorial/displaying-future-posts-in-wordpress/ | |
?> |
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 Poi < ActiveRecord::Migration | |
def self.up | |
create_table :pois, :id => :poi_id do |t| | |
t.column :longitude, :decimal, :precision => 10, :scale => 7 | |
t.column :latitude, :decimal, :precision => 10, :scale => 7 | |
end | |
end | |
def self.down | |
drop_table :pois |
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
find . -name '*.html.erb' | xargs ruby -e 'ARGV.each { |i| puts "html2haml -r #{i} #{i.sub(/erb$/,"haml")}"}' | bash | |
find . -name "*.html.erb" -exec rm -rf {} \; |
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
# Release | |
keytool -exportcert -alias [alias] -keystore [keystore] | openssl sha1 -binary | openssl enc -a -e | |
# Debug | |
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl enc -a -e | |
Password: android |
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
# Model User: | |
has_many :questions | |
has_many :comments | |
# Questions to which the user is an expert a.k.a. 'questions to me' | |
has_many :experts, :dependent => :destroy | |
has_many :questionstome, :through => :experts, :source => :question | |
# This allows you to do things like this: | |
# u = User.first |
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
# export | |
sqlite3 database.sqlite .dump > output.sql | |
# import | |
cat output.sql | sqlite3 database.sqlite |
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
// Source: http://www.anddev.org/resize_and_rotate_image_-_example-t621.html | |
// load the origial BitMap (500 x 500 px) | |
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), | |
R.drawable.android); | |
int width = bitmapOrg.width(); | |
int height = bitmapOrg.height(); | |
int newWidth = 720; |
OlderNewer