Skip to content

Instantly share code, notes, and snippets.

View etewiah's full-sized avatar

Ed Tee etewiah

View GitHub Profile
@etewiah
etewiah / My aliases.txt
Created August 23, 2012 10:42
My aliases
alias dbreset='rake db:drop; rake db:create; rake db:migrate; rake db:seed; rake db:test:prepare'
alias dbupdate='rake db:migrate; rake db:seed; rake db:test:prepare'
alias gcall='git add .; git commit -am'
@etewiah
etewiah / gist:5454122
Created April 24, 2013 17:57
Use Gh3 library to recurse over branches and files in a github repository
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>gh3</title>
</head>
<body>
<h2>Get file contents</h2>
curl http://localhost:3000/assets/preload_store.js -O
curl http://localhost:3000/assets/locales/i18n.js -O
curl http://localhost:3000/assets/locales/en.js -O
curl http://localhost:3000/assets/logster.js -O
curl http://localhost:3000/assets/env.js -O
curl http://localhost:3000/assets/discourse/lib/probes.js -O
curl http://localhost:3000/assets/handlebars.js -O
curl http://localhost:3000/assets/development/jquery-2.1.1.js -O
curl http://localhost:3000/assets/jquery_include.js -O
curl http://localhost:3000/assets/development/ember.js -O
@etewiah
etewiah / count_total_project_code_lines_in_sublime
Last active August 29, 2015 14:26 — forked from Hexodus/count_total_project_code_lines_in_sublime
Count total code lines in project using Sublime texteditor
// Go to menue:
// find->find in files
// Switch on reg_ex button
// Find:
^(.*)$
// Where:
c:\your_folder\,*.php,*.phtml,*.js,*.inc,*.html, -*/folder_to_exclude/*
// Then click on the find button
// Be careful to not click on Replace!!!
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.3.4
-----> Installing dependencies using bundler 1.15.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
2018-01-29T02:22:40.331758837Z app[web.1]: [9ce2d1f3-a09d-41c5-9ea9-b4daf4afd36d] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/model_schema.rb:343:in `columns_hash'
2018-01-29T02:22:40.331764530Z app[web.1]: [9ce2d1f3-a09d-41c5-9ea9-b4daf4afd36d] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/dynamic_matchers.rb:60:in `block in valid?'
2018-01-29T02:22:40.331770265Z app[web.1]: [9ce2d1f3-a09d-41c5-9ea9-b4daf4afd36d] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/dynamic_matchers.rb:60:in `each'
2018-01-29T02:22:40.331776462Z app[web.1]: [9ce2d1f3-a09d-41c5-9ea9-b4daf4afd36d] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/dynamic_matchers.rb:60:in `all?'
2018-01-29T02:22:40.331782294Z app[web.1]: [9ce2d1f3-a09d-41c5-9ea9-b4daf4afd36d] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/dynamic_matchers.rb:60:in `valid?'
2018-01-29T02:22:40.331788025Z app[web.1]:
@etewiah
etewiah / chat_gpt_service.rb
Created December 9, 2022 12:54 — forked from kieranklaassen/chat_gpt_service.rb
Unofficial ChatGPT API Wrapper Ruby
# The ChatGptService class provides an easy way to integrate with the OpenAI ChatGPT API.
# It allows you to send and receive messages in a conversation thread, and reset the thread
# if necessary.
#
# Example usage:
# chat_gpt_service = ChatGptService.new(BEARER_TOKEN)
# response = chat_gpt_service.chat("Hello, how are you?")
# puts response
# # => {"message"=>
# # {"id"=>"8e78691a-1fde-4bd5-ad68-46b23ea65d8f",
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####