Skip to content

Instantly share code, notes, and snippets.

View rstellar's full-sized avatar
💭
I may be slow to respond.

R S rstellar

💭
I may be slow to respond.
View GitHub Profile
@rstellar
rstellar / botDetector.js
Created January 11, 2024 02:16
Twitter bot detector
const filterConsecutiveNumbers = (array) => {
const regex = /\d{5}$/;
return array.filter(item => regex.test(item) && isConsecutive(item.slice(-5)));
};
const isConsecutive = (numStr) => {
for (let i = 0; i < numStr.length - 1; i++) {
if (parseInt(numStr[i]) + 1 !== parseInt(numStr[i + 1])) {
return false;
}
@rstellar
rstellar / gist:0c9a4c532bca057aa4ec0e0ed983b24f
Created July 17, 2018 05:45
When we get a 403 because we white listed everything but the staging domain. Now the test ip bonks out and doesn't let the app run.
#!/bin/bash -eo pipefail
set -eux
mkdir -p /tmp/test-results/cucumber
TEST_FILES="$(ruby ../.circleci/split_cukes.rb split | circleci tests split --split-by=timings --timings-type=testname | ruby ../.circleci/split_cukes.rb files)"
bundle exec cucumber -p ci --format junit --out /tmp/test-results/cucumber/junit.xml --format rerun --out /tmp/rerun.txt $TEST_FILES || \
bundle exec cucumber -p ci --format junit --out /tmp/test-results/cucumber/junit2.xml --format rerun --out /tmp/rerun2.txt @/tmp/rerun.txt || \
bundle exec cucumber -p ci --format junit --out /tmp/test-results/cucumber/junit3.xml @/tmp/rerun2.txt
+ mkdir -p /tmp/test-results/cucumber
++ ruby ../.circleci/split_cukes.rb split
++ circleci tests split --split-by=timings --timings-type=testname
@rstellar
rstellar / gist:29cddc3f07d76b01d0cbb98db049de5e
Created July 17, 2018 05:40
Intercom errors interspersed with Cucumber
+ mkdir -p /tmp/test-results/cucumber
++ ruby ../.circleci/split_cukes.rb split
++ ruby ../.circleci/split_cukes.rb files
++ circleci tests split --split-by=timings --timings-type=testname
+ TEST_FILES='features/documents.feature:132
features/login.feature:73'
+ bundle exec cucumber -p ci --format junit --out /tmp/test-results/cucumber/junit.xml --format rerun --out /tmp/rerun.txt features/documents.feature:132 features/login.feature:73
Deprecated: Found tagged hook with '~@javascript'. Support for '~@tag' will be removed from the next release of Cucumber. Please use 'not @tag' instead.
Deprecated: Found tagged hook with '~@no-database-cleaner'. Support for '~@tag' will be removed from the next release of Cucumber. Please use 'not @tag' instead.
Deprecated: Found tagged hook with '~@no-database-cleaner'. Support for '~@tag' will be removed from the next release of Cucumber. Please use 'not @tag' instead.
@rstellar
rstellar / Keybase.md
Created March 21, 2018 20:03
Keybase proof

Keybase proof

I hereby claim:

  • I am rstellar on github.
  • I am rstellar (https://keybase.io/rstellar) on keybase.
  • I have a public key ASAStJua61xfS479wt_S_RJ9L8LKrSYEoXb5VjEjhBEnwwo

To claim this, I am signing this object:

@rstellar
rstellar / gist:b637e887ebe646ba02b8
Created December 18, 2014 21:25
Kardia ZMQ Config on Heroku server errors
-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/peterkeen/heroku-buildpack-vendorbinaries.git
=====> Detected Framework: VendorBinaries
-----> Found a .vendor_urls file
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> Detected Framework: Node.js
-----> Resetting git environment
-----> Requested node range: 0.10.x
-----> Resolved node version: 0.10.34
@rstellar
rstellar / _.md
Created May 27, 2014 22:20
parallell coordinates
@rstellar
rstellar / User.js
Created September 22, 2013 22:37
Phantomrunner Rewrite into MySQL/EAN stack. Using a Nakstad design pattern (http://frederiknakstad.com/authentication-in-single-page-applications-with-angular-js/) Commented-out lines 166-192 were previously incorporated into the runkeeper strategy function, starting at 142.
'use strict';
//var config = require('./config.json');
var _ = require('underscore');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var FacebookStrategy = require('passport-facebook').Strategy;
@rstellar
rstellar / Runkeeper OAuth unable to pull profile object.
Created September 22, 2013 19:40
Hello, Currently trying to set up a Node/Express/Angular app with Passport and calling to Runkeeper is a key feature. I am successfully able to get my login to redirect to Runkeeper and return with a token. I am having a problem with my 'find or create user' function for new users. Runkeeper returns an object with a profile key and a value '/pro…
runkeeperStrategy: function() {
if(!config.runkeeper.clientID) { throw new Error('A Runkeeper App ID is required if you want to enable login via Facebook.');}
if(!config.runkeeper.clientSecret) { throw new Error('A Runkeeper App Secret is required if you want to enable login via Facebook.');}
return new RunkeeperStrategy({
clientID: config.runkeeper.clientID,
clientSecret: config.runkeeper.clientSecret,
callbackURL: config.runkeeper.callbackURL || 'http://localhost:3000/auth/runkeeper/callback'
},
function(accessToken, refreshToken, profile, done) {