Skip to content

Instantly share code, notes, and snippets.

View marcamillion's full-sized avatar

Marc Gayle marcamillion

View GitHub Profile
@marcamillion
marcamillion / NYTPaywallWorkaround.md
Created August 29, 2021 23:02 — forked from FermiDirak/NYTPaywallWorkaround.md
Steps to get around NYT Paywall

A step by step guide wallthrough on how to access / read a NYT paywalled article

  1. Open the NYT article you want to read in incognito mode
  2. Open up your devtool console ([cmd][shift][j] on chrome/mac)
  3. Open up the devtools command prompt ([cmd][shift][P] on chrome/mac)
  4. Type in the command disable javascript into the command prompt, but don't hit enter
  5. Reload the page
  6. After the content loads but before the paywall appears, enter your disable javascript command
  7. If paywall persists, return to step 3. Otherwise, enjoy your free article.
  8. Happy reading!
class CreateVideos < ActiveRecord::Migration
def change
create_table :videos do |t|
t.string :video
t.text :meta_info
t.timestamps
end
end
end

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@marcamillion
marcamillion / posterous_import.rb
Last active December 16, 2015 20:29 — forked from nitrogenlogic/00_posterous_import_moved.md
Added support for posts that were archived by Posterous - i.e. moved the images into subfolders belonging to dates & times that don't correspond (obviously) to the publish date of the post itself.
#!/usr/bin/env ruby
# This quick and dirty script imports posts and images exported by the
# Posterous backup feature into Octopress. Requires the escape_utils and
# nokogiri gems. Doesn't import comments.
#
# Videos and images are copied into a post-specific image directory used
# by my customized Octopress setup. Encoded videos are downloaded from
# Posterous. Images will probably need to be compressed/optimized afterward.
#
# Links to other posts in the same import will try to be converted. You will
@marcamillion
marcamillion / method_missing_override.rb
Created December 17, 2012 08:29 — forked from anonymous/gist:4316571
This allows you to do something like this: Say Advertiser is an assoc on banner, you could do something like: Advertiser.first.featured_banners And if you later add a banner type named 'Awesome' you could immediately call Advertiser.first.awesome_banner without writing new code in the model.
#Here's what I'm using. Maybe you could adapt it to your case. I have this on a Message model.
def method_missing(method_name, *args, &block)
if method_name =~ /(.*)_recipients$/
self.correspondences.where('recipient_type = ?', $1.to_s.humanize)
.collect{ |c| c.recipient }.flatten.uniq
else
super
end
end
@marcamillion
marcamillion / best_in_place_fix.js.coffee
Created December 3, 2012 16:33 — forked from mkelley33/best_in_place_fix.js.coffee
best_in_place: fix disappearing line-breaks in textarea
jQuery ->
$('[id^="best_in_place_your_object_"],[id$="address"]').on 'best_in_place:update', (event) ->
$address = $(event.target)
$address.data('bestInPlaceEditor').original_content = $address.html()
$address.html $address.html().replace(/[\n\r]+/g, '<br>')
# Get a URL's content to play with
content = contents[contents.keys.first]
# => [#<Nokogiri::XML::Element:0x48a9a86 name="p" children=[#<Nokogiri::XML::Text:0x48a9810 "The autobiography of Yohwan Lim, ">, #<Nokogiri::XML::Element:0x48a96ee name="i" children=[#<Nokogiri::XML::Text:0x48a9536 "Crazy As Me">]>, #<Nokogiri::XML::Text:0x48a931a " was released in Korea by BookRoad Publishers in October 25, 2004. This is my translation of the book, except the following four sections which were translated by BinaryStar of Teamliquid.net, which I have made minor changes: \"Hope on the Road Not Taken,\" \"Chapter One: The Game-crazed Kid,\" \"The Birth of the Emperor,\" and \"The Little Prince with Three Sisters.\"">]>, #<Nokogiri::XML::Element:0x48a9194 name="p" children=[#<Nokogiri::XML::Text:0x48a9022 "As of October 4, 2004:">]>, #<Nokogiri::XML::Element:0x48a8e92 name="p">, #<Nokogiri::XML::Element:0x48a8ce4 name="p" children=[#<Nokogiri::XML::Text:0x48a8af0 "The addition of e-sports organizations to major compani
@marcamillion
marcamillion / feedbacks_controller.rb
Created September 17, 2011 10:09
Just in case I need it.
class FeedbacksController < ApplicationController
before_filter :find_user
def show
@feedback = @user.feedbacks.find(params[:id])
end
private
def find_user
@marcamillion
marcamillion / named_routes.rb
Created September 4, 2011 23:35
Rake routes
feedbacks GET /:username/feedbacks(.:format) {:action=>"index", :controller=>"feedbacks"}
POST /:username/feedbacks(.:format) {:action=>"create", :controller=>"feedbacks"}
new_feedback GET /:username/feedbacks/new(.:format) {:action=>"new", :controller=>"feedbacks"}
edit_feedback GET /:username/feedbacks/:id/edit(.:format) {:action=>"edit", :controller=>"feedbacks"}
feedback GET /:username/feedbacks/:id(.:format) {:action=>"show", :controller=>"feedbacks"}
PUT /:username/feedbacks/:id(.:format) {:action=>"update", :controller=>"feedbacks"}
DELETE /:username/feedbacks/:id(.:format) {:action=>"destroy", :controller=>"feedbacks"}