Skip to content

Instantly share code, notes, and snippets.

Phil Monroe phil-monroe

Block or report user

Report or block phil-monroe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AMIUtils.java
public class AMIUtils {
static String SELL_WITH_AMI_PACKAGE = "com.maven_labs.maven";
public static void openSellWithAMI(Context context) {
if(isPackageInstalled(SELL_WITH_AMI_PACKAGE, context.getPackageManager())) {
openLink("mavenami://", context);
} else {
try {
openLink("market://details?id=" + SELL_WITH_AMI_PACKAGE, context);
View client-side-style-validation.js
var all = $("[class]")
all.map(function(idx, el) { console.log({ el: el.tagName, id: el.id, class: $(el).attr('class') } ) } )
View apify-browser-events.js
const crawler = new Apify.PuppeteerCrawler({
launchPuppeteerFunction: () => {
return Apify.launchPuppeteer({
// puppeteer config options
}).then((browser) => {
browser.on('disconnected', console.log)
browser.on('targetchanged', console.log)
browser.on('targetcreated ', console.log)
browser.on('targetdestroyed', console.log)
return browser
@phil-monroe
phil-monroe / oauth_controller.rb
Created Jun 27, 2019
Authenticate Active Admin + Sidekiq w/ OmniAuth (Google)
View oauth_controller.rb
class Admin::OauthController < ApplicationController
def self.authenticated?(request)
session = request.session
session[:email].present? && session[:authenticated_at].present? && (Time.at(session[:authenticated_at]) + 24.hours).future?
end
def self.current_user(request)
session = request.session
OpenStruct.new(email: session[:email],
name: session[:name],
@phil-monroe
phil-monroe / apify-tester.js
Last active Nov 13, 2018
Script to test apify page functions
View apify-tester.js
var page = require('webpage').create();
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg);
};
page.open('https://seneweb.senegence.com/us/products/anti-aging/collagen-night-pak/', function() {
page.includeJs("https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js", function() {
page.evaluate(function() {
View Description.md

This is the title

  • bullet point
  • thing 2
View console_error.txt
TypeError: Cannot read property 'heroku__app' of undefined
at /bundles/kibana.bundle.js?v=9910:92503
at baseFindIndex (/bundles/commons.bundle.js?v=9910:5797)
at Function.<anonymous> (/bundles/commons.bundle.js?v=9910:8712)
at /bundles/kibana.bundle.js?v=9910:92495
at arrayEach (/bundles/commons.bundle.js?v=9910:6760)
at Function.<anonymous> (/bundles/commons.bundle.js?v=9910:8816)
at Object.filterManager.add (/bundles/kibana.bundle.js?v=9910:92493)
at Scope.$scope.filterQuery [as updateFilterInQuery] (/bundles/kibana.bundle.js?v=9910:22553)
at fn (eval at compile (/bundles/commons.bundle.js?v=9910:40962), <anonymous>:4:529)
@phil-monroe
phil-monroe / versioned_mailer_example.rb
Created Apr 17, 2016
Example of how to use mailer versioning in Lale.help
View versioned_mailer_example.rb
class UserMailer < BaseMandrillMailer
# Template in mandrill: ":lang/user/forgot_password/v2"
def forgot_password(user, token)
build_message(user.language, user.email, version: 2) do
# ^ note the named parameter "version"
# Merge Vars...
end
end
@phil-monroe
phil-monroe / example_presenter.rb
Created Feb 2, 2016
My attempt at a presenter and page objects for Rails
View example_presenter.rb
class TestPresenter < Presenter
let(:a) { 5 }
let(:b) { 3 }
let(:c) { a * b }
let(:str) { _.to_s }
let(:sym) { _.to_sym }
let(:to_yaml)
end
You can’t perform that action at this time.