Skip to content

Instantly share code, notes, and snippets.

View jasonmelgoza's full-sized avatar
🏠
Working from home

Jason Melgoza jasonmelgoza

🏠
Working from home
View GitHub Profile
@trey
trey / gist:134815
Last active August 30, 2015 11:54
Display the current year in PHP, Django, and Rails.
<!-- PHP -->
<?php echo date('Y'); ?>
"""
Here's my sample Django settings for a project I recently did. Visit http://damonjablons.wordpress.com to see the explanation.
"""
import os
import socket
# Set DEBUG = True if on the production server
if socket.gethostname() == 'your.domain.com':
DEBUG = False
@croaky
croaky / install-mongo.md
Created October 31, 2009 20:07
install MongoDB on OS X

download and un-tar

create db directory

mkdir -p /data/db

export mongo bin directory

export MONGO_BIN="/Users/lawless/Downloads/mongodb-osx-x86_64-1.0.1/bin"

export PATH="$PATH:$MONGO_BIN"

require 'test_helper'
class StaticPagesControllerTest < ActionController::TestCase
%w( faq about privacy terms_and_conditions ).each do |page|
should_route :get, "/#{page}", :controller => :static_pages, :action => page.to_sym
context "Accessing #{page} page" do
setup { get page }
should_respond_with :success
@alg
alg / routes_rb
Created February 13, 2010 00:03
ActionController::Routing::Routes.draw do |map|
map.with_options :controller => "static_pages" do |pages|
%w( faq about privacy terms_and_conditions ).each do |page|
pages.send(page, page, :action => page)
end
end
# ...
end
# This is an implementation using python-oembed with api.embed.ly
# python-oembed http://code.google.com/p/python-oembed/
import oembed
# Embed.ly Multi Provider API Endpoint
OEMBED_ENDPOINT = 'http://api.embed.ly/oembed/api/v1'
# URL Schemes Supported --- complete list maintained
# http://api.embed.ly/static/data/embedly_regex.json
@sax
sax / partials.rb
Created April 6, 2010 16:38 — forked from lenary/partials.rb
partials for sinatra
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
require 'sinatra/base'
module Sinatra
module Partials
def partial(template, *args)
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

<div class="tab" id="main">
<a href="http://yadda.ya/foo#main">Main</a>
...
</div>
<div class="tab" id="other">
a href="http://yadda.ya/foo#other">Other</a>
...
</div>
.. etc ..
require "rubygems"
require "highline"
require "mechanize"
hl = HighLine.new
email = hl.ask('E-mail: ')
password = hl.ask('Password: '){|q| q.echo = '*'}
list = []