Skip to content

Instantly share code, notes, and snippets.

@alnutile
alnutile / amazonprofile.js
Last active November 12, 2017 20:43 — forked from DTrejo/top3stories.js
Scrape amazon kindle reading list and profile from public page
// Scraping Made Easy with jQuery and SelectorGadget
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga)
// by David Trejo
//
// Install node.js and npm:
// http://joyeur.com/2010/12/10/installing-node-and-npm/
// Then run
// npm install jsdom jquery http-agent
// node numresults.js
//
import pyrax
import os
import sys
import datetime
from novaclient import exceptions
#Loading credentials from ini file
def auth(credential_location="~/.rackspace_cloud_credentials"):
"""
@alnutile
alnutile / gist:5629363
Created May 22, 2013 17:33
This is the output from cap and the deploy file
* 2013-05-22 12:58:20 executing `deploy'
* 2013-05-22 12:58:20 executing `deploy:update'
** transaction: start
* 2013-05-22 12:58:20 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote file://. master"
command finished in 12ms
* executing "if [ -d /var/www/alsstuff2/shared/cached-copy ]; then cd /var/www/alsstuff2/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 2e95e7826fa52b6eaf3d7dda085380d7e39a123d && git clean -q -d -x -f; else git clone -q -b master file:///home/deploy/git/alsBlogRails.git/ /var/www/alsstuff2/shared/cached-copy && cd /var/www/alsstuff2/shared/cached-copy && git checkout -q -b deploy 2e95e7826fa52b6eaf3d7dda085380d7e39a123d; fi"
servers: ["75.98.173.74"]
[75.98.173.74] executing command
@alnutile
alnutile / controller
Created June 7, 2013 03:09
Model and Controller after moving the query logic into the model and using scopes
@speaker_requests_upcoming = SpeakerRequest.published.content(search).date_range(date_start, date_end)
@speaker_requests_upcoming = @speaker_requests_upcoming.paginate(page: params[:page], :order => "date ASC")
@alnutile
alnutile / _states.html.erb
Created June 9, 2013 20:31
Acts As Taggable making a list of a tag using context
#app/views/shared/_states.html.erb
<% states_list.each do |state| %>
<li>
<%= link_to state.name, {:state => state.name} %>
</li>
<% end %>
@alnutile
alnutile / gist:5857999
Created June 25, 2013 12:15
Vagrant for Laravel
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu12_04"
#/etc/hosts
127.0.0.1 pmangular.local.com
@alnutile
alnutile / _footer.html.erb
Created July 7, 2013 10:16
Refinery CMS and twitterbootstrap
<VirtualHost *:80>
ServerName <%= domain %>
DocumentRoot /var/www/<%= application %>/app/current/
<Directory /var/www/<%= application %>/app/current/>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
@alnutile
alnutile / main.js
Created July 9, 2013 12:07
Example of plugin to swap out an image to point left or right as the user clicks the "link"
//Example of file using it
$(document).ready(function () {
$('h2').on('click', function(){
var location = window.location.origin;
var url = "/sites/all/themes/chroma-blue/images";
var down = "down.jpg";
var right = "right.jpg";
//Look in plugins.js
$(this).arrow({
location: location,