An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
| # Drop this file in config/initializers to run your Rails project on Ruby 1.9. | |
| # This is three separate monkey patches -- see comments in code below for the source of each. | |
| # None of them are original to me, I just put them in one file for easily dropping into my Rails projects. | |
| # Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes | |
| # that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's | |
| # true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9. | |
| # | |
| # Andre Lewis 1/2010 | |
| # encoding: utf-8 |
| # | |
| # WillPaginate renderer for will_paginate 2.3.16 to generate HTML code for Twitter Bootstrap | |
| # Put this content in in your config/initializers/will_paginate.rb | |
| module WillPaginate | |
| module ViewHelpers | |
| class BootstrapLinkRenderer < LinkRenderer | |
| def to_html |
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| if Rails.env == "development" | |
| Dir.foreach("#{Rails.root}/app/models") do |model_name| | |
| require_dependency model_name unless model_name == "." || model_name == ".." | |
| end | |
| end | |
| # or for nested models | |
| if Rails.env == "development" | |
| Dir.glob("#{Rails.root}/app/models/**/*.rb") do |model_name| |
| require 'gollum/frontend/app' | |
| require 'digest/sha1' | |
| class App < Precious::App | |
| User = Struct.new(:name, :email, :password_hash, :can_write) | |
| before { authenticate! } | |
| before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end | |
| helpers do |
| function color_meter(cwith, ccolor) { | |
| if (!cwith && !ccolor) return; | |
| var _cwith = (cwith.charAt(0)=="#") ? cwith.substring(1,7) : cwith; | |
| var _ccolor = (ccolor.charAt(0)=="#") ? ccolor.substring(1,7) : ccolor; | |
| var _r = parseInt(_cwith.substring(0,2), 16); | |
| var _g = parseInt(_cwith.substring(2,4), 16); | |
| var _b = parseInt(_cwith.substring(4,6), 16); |
| #!/bin/bash | |
| # | |
| # /etc/init.d/remote_syslog | |
| # | |
| # Starts the remote_syslog daemon | |
| # | |
| # chkconfig: 345 90 5 | |
| # description: Runs remote_syslog | |
| # | |
| # processname: remote_syslog |
| # Configure whenever | |
| set :whenever_environment, rails_env | |
| set :whenever_output, '/var/www/apps/alt12/current/log/crontab.log' | |
| set :whenever_update_flags, "--update-crontab #{whenever_identifier} --set environment=#{whenever_environment}\\&output=#{whenever_output}" # notice the escaping \& passed to the shell |
| namespace :deploy do | |
| # Ask whether to reindex before restarting Passenger | |
| task :restart, :roles => :app, :except => {:no_release => true} do | |
| solr.reindex if 'y' == Capistrano::CLI.ui.ask("\n\n Should I reindex all models? (anything but y will cancel)") | |
| run "touch #{File.join(current_path, 'tmp', 'restart.txt')}" | |
| end | |
| desc 'create shared data and pid dirs for Solr' | |
| task :setup_solr_shared_dirs do | |
| # conf dir is not shared as different versions need different configs |