Skip to content

Instantly share code, notes, and snippets.

View jlstr's full-sized avatar

José Estrella-Campaña jlstr

View GitHub Profile
'use strict';
(function() {
var app = angular.module('services', []);
app.factory('AuthenticationService', ['$http', '$q', '$localStorage',
function($http, $q, $localStorage) {
return {
login: function(credentials) {
@jlstr
jlstr / app.js
Last active August 29, 2015 14:05
(function() {
var app = angular.module('starter', ['ionic', 'controllers', 'ngStorage']);
app.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
desc "starts sidekiq"
task :start_sidekiq do
run "cd /home/deploy/work/tiptotem/current/ && bundle exec sidekiq -d -L /home/deploy/work/tiptotem/current/tmp/sidekiq.log -e production"
end
after 'deploy', 'servers:start_sidekiq'
desc "stops sidekiq"
task :stop_sidekiq do
message = "Sidekiq not working"
run "if [ -z $(ps -ef | awk '/sidekiq/{print $2}') ]; then echo #{message}; else kill -9 $(ps -ef | awk '/sidekiq/{print $2}'); fi"
deploy@ln-tiptotem-dev:~/work/tiptotem/current$ bundle exec sidekiq -e production
2014-01-28T02:54:56Z 18064 TID-1awufc INFO: Booting Sidekiq 2.17.3 with redis options {}
2014-01-28T02:54:57Z 18064 TID-1awufc INFO: Running in ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
2014-01-28T02:54:57Z 18064 TID-1awufc INFO: See LICENSE and the LGPL-3.0 for licensing details.
2014-01-28T02:54:57Z 18064 TID-1awufc INFO: Starting processing, hit Ctrl-C to stop
2014-01-28T02:54:57Z 18064 TID-1msc8y PaymentsWorker JID-f8806c41ade5fbdf929b2149 INFO: start
2014-01-28T02:54:57Z 18064 TID-1mzs9k PaymentsWorker JID-550902038b468fe9c10b6ab5 INFO: start
2014-01-28T02:54:57Z 18064 TID-1of33o PaymentsWorker JID-a12bc7a8839d74e620b5341b INFO: start
2014-01-28T02:54:57Z 18064 TID-1mqypw PaymentsWorker JID-93c9a65713a0bea5f9a2871d INFO: start
2014-01-28T02:54:57Z 18064 TID-1mqx58 PaymentsWorker JID-198f40ab881b8306677bd207 INFO: start
Started POST "/ipn_notify" for 173.0.82.126 at 2014-01-22 21:31:18 +0000
Processing by PaypalNotificationsController#ipn_notify as HTML
Parameters: {"max_number_of_payments"=>"null", "starting_date"=>"2014-01-23T00:00:00.000Z", "pin_type"=>"NOT_REQUIRED", "max_amount_per_payment"=>"50.00", "currency_code"=>"USD", "sender_email"=>"[email protected]", "verify_sign"=>"AYSagOJAEOmkYvl-SjMuGt2WlgoKAsNoPT4BqS1ghze8zjrP3W0GDX02", "test_ipn"=>"1", "date_of_month"=>"0", "current_number_of_payments"=>"0", "preapproval_key"=>"PA-35J543363V334994W", "ending_date"=>"2015-01-17T00:00:00.000Z", "approved"=>"true", "transaction_type"=>"Adaptive Payment PREAPPROVAL", "day_of_week"=>"NO_DAY_SPECIFIED", "status"=>"ACTIVE", "current_total_amount_of_all_payments"=>"0.00", "current_period_attempts"=>"0", "charset"=>"Shift_JIS", "payment_period"=>"0", "notify_version"=>"UNVERSIONED", "max_total_amount_of_all_payments"=>"2000.00"}
WARNING: Can't verify CSRF token authenticity
------------------------------------------------
class PaypalNotificationsController < ApplicationController
def ipn_notify
if PayPal::SDK::Core::API::IPN.valid?(request.raw_post)
#logger.info("IPN message: VERIFIED")
puts "\n\n V E R I F I E D \n\n\n"
render :text => "VERIFIED"
else
#logger.info("IPN message: INVALID")
<% publish_to "/messages/#{current_user.convos.first.id}/chat" do %>
$('#message-display').append("<%= j render partial: 'shared/single_message', locals: { user: current_user } %>")
<% end %>
<!DOCTYPE html>
<html>
<head>
<title>Ninja Template</title>
<style>
body { background: #d6d6d6; }
#results li.pass { color: green; }
#results li.fail { color: red; }
</style>
</head>
@jlstr
jlstr / BalancedParentheses.cc
Created October 15, 2013 14:35
MyCodeSchool Problem #44
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class BalancedParentheses {
public:
int checkBalance(string);
};
#include <iostream>
#include <string>
using namespace std;
class RowOrColSum {
public:
long long sumRowOrColumn(long, long, long, char);
};