Skip to content

Instantly share code, notes, and snippets.

View vincentwoo's full-sized avatar

Vincent Woo vincentwoo

View GitHub Profile
# problems:
# words like don't
# reading the entire file in memory
# builds reverse index dumbly, not while iterating, pretty slow
# pros:
# EASY TO CODE FAST
require 'pp'
file = File.open "wordinput.txt", "rb"
# configure cache digests plugin to recognize calls to "partial" helper
regexp_source = CacheDigests::TemplateDigestor::RENDER_DEPENDENCY.to_s
# replace 'render' with a noncapturing group to preserve gem functionality
regexp_source.sub! 'render', '(?:render|partial)'
CacheDigests::TemplateDigestor.instance_eval {remove_const :RENDER_DEPENDENCY}
@vincentwoo
vincentwoo / gist:4541672
Created January 15, 2013 20:20
Batch deleting templates from Sailthru
var url = "https://my.sailthru.com/template?widget=editor&action=delete&template_id="
var payload = {confirm: 1}
var ids = [...];
function del(id) {
$.post(url + id, payload, function(response) {
console.log(response)
if (response.error) {
alert(response.error);
Loading development environment (Rails 3.2.11)
1.9.3p194 :001 > AtLastClient
=> AtLastClient
1.9.3p194 :002 > AtLastClient.class
=> Class
1.9.3p194 :003 > reload!
Reloading...
=> true
1.9.3p194 :004 > AtLastClient.class
=> Module
class AtLastClient
class APIError < StandardError
attr_accessor :atlast_error_type
def initialize error
self.atlast_error_type = error
super("error: #{error}")
end
end

The Riders and Hunters of Men

Here’s an interesting premise. Posit that humans are just the reproductive organs of ideas, and our minds little more than tepid pools of chaotically interchanging notions. We might be hosts whose carefully formulated egos are nothing more than the emergent terrain of an ancient memetic battleground - one imagines long wars between fear and laziness for control of our lizard brains. The memes with the most dominant survival characteristics must have long since evolved - likely candidates being caution, hope, and solidarity. In this paradigm, the most prolific ideas are the hardiest survivors of thousands of years of crossbreeding, their properties now the building blocks of more complicated and fragile abstractions like justice, ambition, and melancholy. The simplest ideas might occupy the lowest and most important rungs of an intellectual ecosystem, akin to our humble meat-space phytoplankton.

A question that then arises is how do ideas like self-

@vincentwoo
vincentwoo / gist:5168806
Last active December 14, 2015 23:49
heroku database_url issue
vwoo@vwoo-VirtualBox:~/tweetshirt$ heroku pg:promote HEROKU_POSTGRESQL_ROSE_URL
Promoting HEROKU_POSTGRESQL_ROSE_URL to DATABASE_URL... done
vwoo@vwoo-VirtualBox:~/tweetshirt$ git push heroku master
Counting objects: 288, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (268/268), done.
Writing objects: 100% (288/288), 54.12 KiB, done.
Total 288 (delta 127), reused 3 (delta 0)
-----> Ruby/Rails app detected
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>html.erb</string>
</array>
<key>name</key>
<string>JSFoot HTML (Rails)</string>
@vincentwoo
vincentwoo / JSFoot HTML (Rails).tmLanguage
Last active December 15, 2015 17:59 — forked from anonymous/JSFoot HTML (Rails).tmLanguage
Save as SUBLIME_DIRECTORY/Packages/User/JSFoot HTML (Rails).tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>html.erb</string>
</array>
<key>name</key>
<string>JSFoot HTML (Rails)</string>
@vincentwoo
vincentwoo / preload
Last active December 16, 2015 09:09
900ish classes I needed in mini-rt.tar to not need to pull stuff over the wire
classes/util/Javac.class
vendor/classes/com/sun/source/tree/ArrayAccessTree.class
vendor/classes/com/sun/source/tree/ArrayTypeTree.class
vendor/classes/com/sun/source/tree/AssignmentTree.class
vendor/classes/com/sun/source/tree/BinaryTree.class
vendor/classes/com/sun/source/tree/BlockTree.class
vendor/classes/com/sun/source/tree/CatchTree.class
vendor/classes/com/sun/source/tree/ClassTree.class
vendor/classes/com/sun/source/tree/CompilationUnitTree.class
vendor/classes/com/sun/source/tree/EnhancedForLoopTree.class