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
from locust import HttpLocust, TaskSet | |
import json | |
import random | |
import pdb | |
import urllib3 | |
urllib3.disable_warnings() | |
APIKEY = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJhMzI2Zjg5Ny02ODYxLTQyNjUtYTRlNi02N2RkY2VlOWZlODYiLCJpYXQiOjE1NzQ4NTkxNTksInN1YiI6MTAwMDAxLCJhdWQiOjIsImlzcyI6bnVsbH0.UQAA3DaKk8rCQdbKNIA2kn6jFWvbvwvoPdZdsJXCMXY" |
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
<div id="app"></div> | |
<script src="https://brandy.ngrok.io/static/main.js" /> |
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
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script> | |
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script> | |
<script> | |
'use strict'; | |
const e = React.createElement; | |
class LikeButton extends React.Component { | |
constructor(props) { | |
super(props); |
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
# data.txt have \n separated lines with lat long alt separated by space | |
f = File.read('data.txt') | |
pairs = f.split("\n") | |
def build_url(lat,long) | |
"http://www.mapquestapi.com/geocoding/v1/reverse?key=KEY&location=#{lat},#{long}&includeRoadMetadata=true&includeNearestIntersection=true" | |
end | |
records = pairs.map do |p| | |
lat, long, _ = p.split(' ') | |
url = build_url(lat, long) |
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
cl = OmniAuth::Strategies::Cnh.new(:cropio) | |
record = request.env["omniauth.auth"].credentials.to_hash | |
hash = record.dup | |
hash["expires"] = hash["expires_at"] | |
token = OAuth2::AccessToken.from_hash(cl.client, hash) |
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
# frozen_string_literal: true | |
def field_group_hull(id) | |
field_ids = field_group_fields(field_group.id) | |
return nil if field_ids.blank? | |
geometry = fields_hull(field_ids) | |
end | |
def find_fields_inside_rect(rect) |
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 BasicBoard | |
def initialize(scope) | |
@scope = scope | |
end | |
def scope | |
@scope | |
end | |
protected :scope |
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
require 'ostruct' | |
module Null | |
class Object < OpenStruct | |
# Redefine in ancesotrs | |
# | |
# @return [Class] define class for which NullObjectPattern implemented | |
def self.base_class | |
::Object | |
end |
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
tshark -r infile -T fields -e data | tr -d '\n' > tempfile |
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
# https://github.com/ruby-prof/ruby-prof | |
require 'ruby-prof' | |
class DevProfiler | |
BASE_PATH = "#{Rails.root}/tmp/performance/#{file_name}" | |
def self.prof(file_name) | |
RubyProf.start | |
puts "Start profiling method" | |
yield | |
puts "Done Profiling!" |