Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mattvv's full-sized avatar

Matt Van mattvv

View GitHub Profile
@mattvv
mattvv / routesecurity.js
Created February 25, 2014 21:57
AngularJS FireBase SimpleLogin with ui.router
(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 / loadfail
Created March 22, 2012 19:43
Opensips Load Fail
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
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)? $
[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
@mattvv
mattvv / Provisioning\Voip.pm
Created October 11, 2012 00:04
Check if a Subscriber is on a call for SipWise
=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
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 March 17, 2014 19:15
Include this in your test_helper.rb to stub your stripe checkout.js
#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 / facebookToAsyncAwait.js
Created September 4, 2018 17:07
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
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;