This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.include(Maven::ArelProxy::ActiveRecordExtension) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.identified.helpers; | |
import org.apache.avro.Schema; | |
import org.apache.avro.io.*; | |
import org.apache.avro.specific.SpecificDatumReader; | |
import org.apache.avro.specific.SpecificDatumWriter; | |
import org.apache.avro.specific.SpecificRecordBase; | |
import java.io.ByteArrayOutputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to your project specific .gitignore | |
# Ignore pry console history for this project - https://gist.github.com/phil-monroe/96bfde675e50ca2dd7080348565b887d | |
.pry_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include this in the config/application.rb of your rails application | |
require 'colorize' | |
ActiveSupport::Dependencies.singleton_class.prepend(Module.new do | |
def load_missing_constant(*args) | |
arg_str = args.map(&:to_s).select { |arg| arg != 'Object' }.join('::').green | |
start = Time.now | |
result = nil | |
mv_with_indent do |indent| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var all = $("[class]") | |
all.map(function(idx, el) { console.log({ el: el.tagName, id: el.id, class: $(el).attr('class') } ) } ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p ~/bin/ | |
curl -s -L https://gist.github.com/raw/4477190/pmrcp.rb > ~/bin/pmrcp | |
chmod +x ~/bin/pmrcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
NewerOlder