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!
<pre class="highlight ruby">
<p>def convert_relation(invited_gender, relation)<br>
case invited_gender<br>
when &quot;male&quot;<br>
case relation<br>
when &quot;daughter&quot;, &quot;son&quot; then &quot;dad&quot;<br>
when &quot;mom&quot;, &quot;dad&quot; then &quot;son&quot;<br>
when &quot;grandfather&quot;, &quot;grandmother&quot; then &quot;grandson&quot;<br>
when &quot;sister&quot;, &quot;brother&quot; then &quot;brother&quot;<br>
when &quot;wife&quot; then &quot;husband&quot;<br>
@marcamillion
marcamillion / finding-deleted-associated-records-by-inverse-using-where-not.rb
Last active December 23, 2015 11:30
Easily Find Polymorphically Associated Records whose destroy callbacks were not called
# The main issue here is, if you do a bunch of delete calls on a model that has associations there will be some other records that
# still exist and point to legit looking values that don't work, because even though the foreign_key exists in the table,
# the record it is pointing to does not.
# For e.g. A User and an Event
# == Schema Information
#
# Table name: users
#
class CreateVideos < ActiveRecord::Migration
def change
create_table :videos do |t|
t.string :video
t.text :meta_info
t.timestamps
end
end
end
@marcamillion
marcamillion / index.css
Created September 17, 2014 19:11
Word & Character Counter in JS - as originally seen: http://jsfiddle.net/deepumohanp/jZeKu/
#border {
border: 1px solid red;
height: 200px;
width: 100%;
}
textarea {
height: 100%;
width: 100%;
border: 0px;
}
The page build failed with the following error:
The submodule `octopress` was not properly initialized with a `.gitmodules` file.
For information on troubleshooting Jekyll see:
https://help.github.com/articles/using-jekyll-with-pages#troubleshooting
class Player
def play_turn(warrior)
if warrior.feel.empty? && !taking_damage?(warrior) && warrior.health < 20
warrior.rest!
elsif warrior.feel.empty?
warrior.walk!
else
warrior.attack!
end
@health = warrior.health
class Player
def play_turn(warrior)
if @health.nil?
@health = warrior.health
end
if warrior.feel.empty? && !taking_damage?(warrior) && warrior.health < 20
warrior.rest!
elsif warrior.feel.captive?
warrior.rescue!

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.