Skip to content

Instantly share code, notes, and snippets.

Matt Van mattvv

Block or report user

Report or block mattvv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattvv
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
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
Capybara::Server.new(instance).tap { |server| server.boot }
end
get '/checkout.js' do
@mattvv
mattvv / routesecurity.js
Created Feb 25, 2014
AngularJS FireBase SimpleLogin with ui.router
View routesecurity.js
(function (angular) {
'use strict';
angular.module('iwillApp')
.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
mattvv / Provisioning\Voip.pm
Created Oct 11, 2012
Check if a Subscriber is on a call for SipWise
View Provisioning\Voip.pm
=item B<check_live> { $username, $domain, \%data }
=back
=over
Checks if a certain subscriber is on a call. Returns true if they are and false if they are not.
=back
View gist:2511859
[common]
# Default Method to Request RESTXML or to send Params
DEFAULT_HTTP_METHOD = POST
# Incoming calls will always use those urls to post answer/hangup events
# By default, hangup url is same as answer url
DEFAULT_ANSWER_URL = http://testproject.heroku.com/
#DEFAULT_HANGUP_URL = http://127.0.0.1:5000/hangup/
# Set proxy if needed
View gist:2381060
root@web01-stg:
/opt/web/current(deploy)? $ bundle show acts_as_async
/opt/rubygems/gems/acts_as_async-0.2.4
root@web01-stg:
/opt/web/current(deploy)? $ bundle show authlogic
/opt/rubygems/bundler/gems/authlogic-2e8613545c27
root@web01-stg:
/opt/web/current(deploy)? $
@mattvv
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
You can’t perform that action at this time.