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 fetch = require('node-fetch') | |
const ex = require('execa') | |
const writeKey = '<your_segment_write_key>' | |
const btoa = (val) => Buffer.from(val).toString('base64') | |
const getBranch = async () => | |
(await ex('git', ['branch', '--show-current'])).stdout | |
async function increment(metric, value = 0, tags = []) { |
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 puppeteer = require('puppeteer') | |
const say = require('say') | |
async function find(page) { | |
await page.goto( | |
'https://www.tesla.com/inventory/new/my?arrangeby=relevance&zip=78724&range=200', | |
{ | |
waitUntil: 'networkidle2', | |
} | |
) |
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
async function onTrack(event, settings) { | |
if (event.event !== settings.eventName) { | |
return; | |
} | |
const product = event.properties.products[0]; | |
const itemPurchased = `${product.brand} ${product.name}`; | |
const Body = `Thank you for purchasing ${itemPurchased} from our site. We will follow-up with the tracking details shortly.`; | |
const To = settings.twilioDestinationNumber; |
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
/* @flow */ | |
const Rx = require('rxjs/Rx'); | |
const axios: axios = require('axios'); | |
const requestStream: rxjs$Observable<string> = Rx.Observable.of( | |
'https://api.github.com/users' | |
); | |
const responseMetaStream: rxjs$Observable<any> = requestStream.map( | |
(requestUrl: string): rxjs$Observable<any> => |
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
query { | |
rubygem: by_name(name: "rails") { | |
name | |
downloads | |
versions { | |
number | |
authors | |
} | |
} |
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
# NewRelic instrumenter for GraphQL-ruby | |
# | |
# In your controller: | |
# ::NewRelic::Agent.add_custom_attributes({ | |
# user_id: @user.try(:id), | |
# query_string: @query_string, | |
# query_arguments: @query_variables | |
# }) | |
# | |
# @document = self.class.trace_execution_scoped(["GraphQL#parse"]) do |
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
// Netto Farah | |
// Feb 11 2017 | |
function mergeSort(array) { | |
// Clone array so we don't modify the input. | |
// This shouldn't be necessary in most cases | |
array = array.slice(0, array.length) | |
// msort is what we use to divide the problem | |
function msort(array, low, high) { |
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
javascript:void(function() { | |
var pending = jQuery('.pending').find('td:last'); | |
var values = Array.from(pending).map(td => jQuery(td).text().replace("$", "").replace("–", "-")); | |
values = values.filter(val => jQuery.trim(val)).map(parseFloat); | |
var pendingTotal = values.reduce((val, current) => val + current); | |
var currentTotalElement = jQuery('.account').first().find('.money').last(); | |
var currentTotal = parseFloat(currentTotalElement.text().replace("–", "-").replace("$", "")); | |
var realTotal = currentTotal + pendingTotal; |
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
javascript:void(function() { | |
var $ = window.jQuery; | |
function floatValue(element) { | |
var text = $(element).text().trim().replace(",", "").replace("$", ""); | |
return parseFloat(text); | |
} | |
function updateCurrentBalance() { | |
var balanceElement = jQuery('div[data-attr="CREDIT_CARD_ACCOUNT.accountCurrentBalance"]'); |
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
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' |
NewerOlder