Skip to content

Instantly share code, notes, and snippets.

@danpariente
danpariente / gist:3457126
Created August 24, 2012 23:24
Automated User Chat Room Creator
require 'mechanize'
class ChatRoomConnector
attr_accessor :generated_password, :username, :email
def initialize(username)
@username = username
@email = ""
@generated_password = ""
@agent = Mechanize.new
@danpariente
danpariente / gist:3457157
Created August 24, 2012 23:27
News Classifier
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'rss/2.0'
class RssParser
attr_accessor :url
def initialize(url)
@url = url
@danpariente
danpariente / fb_search_crawler.rb
Created October 1, 2012 12:55
Facebook Search Crawler
require 'mechanize'
agent = Mechanize.new
page = agent.get('https://m.facebook.com/')
login_form = page.forms.first
login_form.email = "user@mail.com"
login_form.pass = "password"
main_page = agent.submit(login_form, login_form.buttons.first)
@danpariente
danpariente / spanish_stop_words.txt
Created October 9, 2012 16:51
Spanish Stop Words
de
la
que
el
en
y
a
los
del
se
@danpariente
danpariente / rspec-syntax-cheat-sheet.rb
Created December 4, 2012 20:14 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@danpariente
danpariente / git_flow
Last active December 11, 2015 18:38
My Git Flow
git checkout -b feature && git push -u
git commit -am "$COMMIT_MESSAGE"
git add $FILES_TO_ADD
git commit -m "$COMMIT_MESSAGE"
git add -p $PATH_TO_FILE
git diff master feature
package com.apptegy.arkadelphia.questions;
import android.app.ProgressDialog;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
@Override
protected JSONObject doInBackground(String... urls) {
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(urls[0]);
JSONObject holder = new JSONObject();
JSONObject userObj = new JSONObject();
String response = null;
JSONObject json = new JSONObject();
try {
@danpariente
danpariente / gist:8153048
Created December 27, 2013 21:43
token authentication
def authenticate_user
@current_user = User.find_by_authentication_token(params[:token])
unless @current_user
respond_with({ error: 'Token is invalid.' })
end
end
attachments: parent_id, asset_id
domain_names: organisation_id
event_memberships: user_id, event_id
events: editor_id
group_actions: user_id, group_id
groups: user_id
icons: parent_id
invitations: sender_id
legacy_actions: item_upon_id
news_items: author_id