Skip to content

Instantly share code, notes, and snippets.


Matt Van mattvv

View GitHub Profile
mattvv / facebookToAsyncAwait.js
Created Sep 4, 2018
Facebook API only returns pages of friends that use the app. This code allows you to fetch all the users of the user who use the app and exposes it in an async function instead of the callback implementation
View facebookToAsyncAwait.js
import { GraphRequest, GraphRequestManager } from 'react-native-fbsdk';
//Gets all your friends who have used the app, exploding facebook's caching.
export const getFriends = async () => {
try {
let { pagedFriends, cursor } = await friendsRequest();
let allFriends = pagedFriends;
while (pagedFriends.length > 0) {
let request = await friendsRequest(cursor);
pagedFriends = request.pagedFriends;
View resqueHelper.js
var async = require('async');
var _ = require('underscore');
module.exports = {
initialize: function(api, next){
function nullOrErrorResult(err, result) {
return (err || result === null || result.length === 0);
mattvv / credit_card_helper.rb
Created Mar 17, 2014
Include this in your test_helper.rb to stub your stripe checkout.js
View credit_card_helper.rb
#this is a very simple, work in progress helper method for stubbing the stripe checkout.js
#this creates a fake server that will generate stripe token as if it's coming from stripe. So we can test credit card input
class FakeStripe < Sinatra::Base
def self.boot
instance = new { |server| server.boot }
get '/checkout.js' do
mattvv / routesecurity.js
Created Feb 25, 2014
AngularJS FireBase SimpleLogin with ui.router
View routesecurity.js
(function (angular) {
'use strict';
.run(function ($injector, $location, $rootScope, loginRedirectPath) {
if ($injector.has('$state')) {
new RouteSecurityManager($location, $rootScope, $injector.get('$state'), loginRedirectPath);
function RouteSecurityManager($location, $rootScope, $state, path) {
mattvv / Provisioning\
Created Oct 11, 2012
Check if a Subscriber is on a call for SipWise
View Provisioning\
=item B<check_live> { $username, $domain, \%data }
Checks if a certain subscriber is on a call. Returns true if they are and false if they are not.
View gist:2511859
# Default Method to Request RESTXML or to send Params
# Incoming calls will always use those urls to post answer/hangup events
# By default, hangup url is same as answer url
# Set proxy if needed
View gist:2381060
/opt/web/current(deploy)? $ bundle show acts_as_async
/opt/web/current(deploy)? $ bundle show authlogic
/opt/web/current(deploy)? $
mattvv / loadfail
Created Mar 22, 2012
Opensips Load Fail
View loadfail
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:sl:mod_init: Initializing StateLess engine
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:tm:mod_init: TM - initializing...
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:rr:mod_init: rr - initializing
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:maxfwd:mod_init: initializing...
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:usrloc:ul_init_locks: locks array size 512
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:registrar:mod_init: initializing...
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:textops:mod_init: initializing...
Mar 22 19:34:46 sip01-stg opensips[4234]: INFO:avpops:avpops_init: initializing...
Mar 22 19:34:46 sip01-stg opensips: INFO:core:daemonize: pre-daemon process exiting with -1