Skip to content

Instantly share code, notes, and snippets.

@perezpaya
perezpaya / login.js
Created September 29, 2012 11:50
Login Gist
function checkLogin (req, res, next){
if(req.session){
if(req.session.email && req.session.password){
User.findOne({email: req.session.email}, function (err, docs){
if(err){
res.render('err.jade');
} else if (docs){
if(docs.password == req.session.password){
next();
} else{

How to iOS

Dear iOS Developer,

These are the things you might take into account when developing rock-solid iOS apps.

Writing better code makes you happy and will make your employer, teammates, and even customers happier in the mid-long term.

Please remember

@perezpaya
perezpaya / challenge.md
Last active October 5, 2020 11:46
Allfunds Coding Challenge

Allfunds Coding Challenge

Our financial department is currently overloaded, they have lots of monthly expense reports waiting to be paid.

This reports consists of three different kind of expenses.

  • TRANSPORTATION (km):
    • Every kilometer is paid at 0.12 $/km
    • When an employee exceeds 100km per month, the next kms are paid at 0.08 $/km

Keybase proof

I hereby claim:

  • I am perezpaya on github.
  • I am alejandro (https://keybase.io/alejandro) on keybase.
  • I have a public key ASCUY5zgkveB26KuhKmCuqbrcC628h-8GnXttauiVLnEfwo

To claim this, I am signing this object:

echo "Borja maricona"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew cask install iterm2
brew cask install atom
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
import SpriteKit
enum GamepadButton {
case Left
case Right
}
class Gamepad: SKNode {
private var leftButton: SKSpriteNode!
private var rightButton: SKSpriteNode!
import SpriteKit
class Joystick: SKNode {
private let substrate: SKSpriteNode
private let stick: SKSpriteNode
var resetAnimationDuration: NSTimeInterval = 0.3
var velocity: CGPoint = .zero
var angularVelocity: CGFloat = 0
describe CompanyMarketUpdatesService, type: :service do
let(:notification_job) { object_spy(NotificationJob) }
let(:service) { described_class.new(notification_job: notification_job)
let(:apple) { Company.create!(name: 'Apple', stock_symbol: 'APPL', stock_volume: 22000000, stock_price: 100.0, number_of_shares: 100000000) }
it 'modifies company stockage information' do
updated_company = service.update(stock_symbol: apple.stock_symbol, stock_volume: 23000000, stock_price: 105.0)
expect(updated_company.stock_price).to eq(105.0)
expect(updated_company.stock_volume).to eq(23000000)
end
class CompanySerializer < ApplicationSerializer
attributes :name,
:stock_symbol,
:stock_price,
:stock_volume,
:number_of_shares,
:volume_price,
:valuation
has_one :ceo
class CompanyMarketUpdatesJob < ApplicationJob
queue_as :default
def perform(params)
ChoosenDatabase::Transaction.new do
CompanyMarketUpdatesService.new.update(params.deep_symbolize_keys)
end
end
end