Skip to content

Instantly share code, notes, and snippets.

View jfeldstein's full-sized avatar

Jordan Feldstein jfeldstein

View GitHub Profile
@jfeldstein
jfeldstein / jQuery.GetUrlVar
Created June 26, 2014 03:01
`$.getUrlVar('foo');` == 'bar' for url.com?foo=bar
<script>
// To convert it to a jQuery plug-in, you could try something like this:
(function($){
$.getUrlVar = function(key){
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
return result && unescape(result[1]) || "";
};
})(jQuery);
</script>
ActiveAdmin.register Person do
index :download_links => false do
column :name
column :primary_email
column :phone
column :zip
column :service
column :vertical
column :age
end
class Person < ActiveRecord::Base
has_and_belongs_to_many :scrapers
default_scope lambda { where :downloaded_at => nil }
def self.queued_for_download
with_exclusive_scope{Person.where{downloaded_at>3.seconds.ago}}
end
end
@jfeldstein
jfeldstein / keybase.md
Created December 29, 2014 23:55
keybase.md

Keybase proof

I hereby claim:

  • I am jfeldstein on github.
  • I am jfeldstein (https://keybase.io/jfeldstein) on keybase.
  • I have a public key whose fingerprint is 66F9 EA61 B4B5 F69B 1CB5 94F4 F20D E6A9 02F8 F1E3

To claim this, I am signing this object:

@jfeldstein
jfeldstein / gist:1fc68d153a7ed0d63baf
Last active August 29, 2015 14:18
DKIM and SPF Instructions for Marketo Customers

Sending @YourDomain.com Email, From Marketo

Before we can send email on your behalf, using your own domain, we need you to set up the correct DKIM and SPF Records which are the internet's way of signing that an email is being sent from an authorized source.

DKIM and SPF Records are special "TXT"-type DNS records set on your domain, and defined in a way that securely give authority to another server to send email from your domain.

What are DNS Records?

If you don't know what DNS records are, you are not the person who should be following this guide. Please find someone who can manage your company's domains' DNS, and give them the following instructions.

@jfeldstein
jfeldstein / CrawleraOFF
Created April 10, 2015 21:58
Crawlera Logs
Time (UTC) Level Message
0: 2015-04-08 21:35:55 INFO Log opened.
1: 2015-04-08 21:35:55 INFO Scrapy 0.25.0-298-g5846d61 started
2: 2015-04-08 21:35:55 INFO using set_wakeup_fd
3: 2015-04-08 21:35:55 INFO Scrapy 0.25.0-298-g5846d61 started (bot: amazon)
4: 2015-04-08 21:35:55 INFO Optional features available: ssl, http11, boto
5: 2015-04-08 21:35:55 INFO Overridden settings: {'NEWSPIDER_MODULE': 'amazon.spiders', 'LOG_LEVEL': 'INFO', 'CONCURRENT_REQUESTS_PER_DOMAIN': 32, 'CONCURRENT_REQUESTS': 32, 'SPIDER_MODULES': ['amazon.spiders'], 'STATS_CLASS': 'hworker.bot.stats.HubStorageStatsCollector', 'BOT_NAME': 'amazon', 'DOWNLOAD_TIMEOUT': 600, 'MEMUSAGE_LIMIT_MB': 512, 'MEMUSAGE_ENABLED': True, 'TELNETCONSOLE_HOST': '0.0.0.0', 'LOG_FILE': 'scrapy.log', 'DOWNLOAD_DELAY': 2.0, 'USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'}
6: 2015-04-08 21:35:56 INFO HubStorage: writing items to http://storage.scrapinghub.com/items/12747/2/
@jfeldstein
jfeldstein / attribution_tracking_js.1.0.min.js
Last active August 29, 2015 14:20
Attribution Tracking Javascripts
(function(){var t,e,n,r,u,i,o,m,_,a,c,s;n=function(){return{first_referrer:e("first_referrer")||u()}},u=function(){var n,r,u,i,o;return o=document.referrer,n=t(o),r=null==n,i=n===t(document.location),u=null==o||i||r?e("latest_referrer"):n,{latest_referrer:u}},r=function(){var t,n,r,u;if(t={first_utm_name:e("first_utm_source"),first_utm_source:e("first_utm_source"),first_utm_medium:e("first_utm_medium"),first_utm_term:e("first_utm_term"),first_utm_content:e("first_utm_content")},null==t.first_utm_name){u=i();for(n in u)r=u[n],t[n.replace("latest_","first_")]=r}return t},i=function(){var t,n,r,u,i,o;return u=c(),r=u.utm_campaign,i=u.utm_source,n=u.utm_medium,o=u.utm_term,t=u.utm_content,null==r&&(r=e("latest_utm_name"),i=e("latest_utm_source"),n=e("latest_utm_medium"),o=e("latest_utm_term"),t=e("latest_utm_content")),{latest_utm_name:r,latest_utm_source:i,latest_utm_medium:n,latest_utm_term:o,latest_utm_content:t}},c=function(){var t,e;return t=document.location.search.substr(1),e={},t.split("&").forEach(functi
@jfeldstein
jfeldstein / categories.txt
Created June 9, 2015 05:16
Educational Categories on Academia.edu
http://www.academia.edu/Documents/in/Alternative_Education
https://www.academia.edu/Documents/in/Peer_observation_of_teaching
https://www.academia.edu/Documents/in/Teaching_Thinking_Skills
https://www.academia.edu/Documents/in/Student_Motivation_And_Engagement
https://www.academia.edu/Documents/in/Transformative_Learning
https://www.academia.edu/Documents/in/Educational_Research
http://www.academia.edu/Documents/in/Academic_Development
https://www.academia.edu/Documents/in/Peer_Support_Learning_and_Teaching_
http://www.academia.edu/Documents/in/Blended_Learning
http://www.academia.edu/Documents/in/Educational_Technology
@jfeldstein
jfeldstein / legacy_campaign.rb
Created July 9, 2015 23:21
SET Campaign: Should Pull? Logic as of 7/9/15
# "LegacyCampaign" is what Super Sonic calls SET campaigns
class LegacyCampaign < ActiveRecord::Base
def self.should_pull(campaign)
vintage = self.is_good_vintage(campaign)
is_a_test = self.is_a_test(campaign)
# Special cases:
nhs_force = (campaign.company.master_branch.try(:name)=='NHS')
@jfeldstein
jfeldstein / circle.yml
Created January 2, 2016 01:38
Run Apache on CircleCI, and save logs as artifacts
machine:
hosts:
local.example.com: 127.0.0.1
dependencies:
pre:
- cp ./httpd.conf.circle /etc/apache2/sites-available/default
- sudo a2enmod rewrite
- sudo service apache2 restart