Skip to content

Instantly share code, notes, and snippets.

View victoraguilarc's full-sized avatar
🧭
Working

Victor Aguilar C. victoraguilarc

🧭
Working
View GitHub Profile
1) Quit Xcode, Simulator, Instruments, etc.
2) Run in Terminal: sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
3) Run in Terminal: sudo rm -rf ~/Library/*/CoreSimulator
# Was tested on Xcode 10.2 and iOS Simulator 12.2
@victoraguilarc
victoraguilarc / processors.py
Last active January 4, 2022 18:16
Card processors
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Any, Optional
class CardSettings(object):
def load_credentials():
pass
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>s:0</faultcode>
<faultstring xml:lang="en-US">No se ha podido procesar su peticion. Intentelo mas tarde, si el problema persiste provea el siguiente ticket a su area de soporte tecnico: c1</faultstring>
<detail>
<ErrorDetailInfo z:Id="1" z:Type="Scisa.Framework.Services.Messaging.ErrorDetailInfo" z:Assembly="Scisa.Framework.2013.Services, Version=2019.11.13.1734, Culture=neutral, PublicKeyToken=null" xmlns="http://schemas.datacontract.org/2004/07/Scisa.Framework.Services.Messaging" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<Code>0</Code>
<HowToFix z:Id="2">http://localhost:808/PLD/QA/SigloNet/errors.html#0</HowToFix>
<MoreInfo z:Id="3">http://localhost:808/PLD/QA/SigloNet/errors.html#0</MoreInfo>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Header>
<SCISAHeaders xmlns="http://www.scisa.com.mx/scisasuite">
<SCISA_ApplicationID>21BF6586-84B2-4A86-9BF6-0819C7366CE7</SCISA_ApplicationID>
<SCISA_UserName>scisaservices</SCISA_UserName>
<SCISA_Password>scisaservices</SCISA_Password>
</SCISAHeaders>
</Header>
<Body>
<ImportOnDemand xmlns="http://www.scisa.com.mx/focys/v1/contracts/">
bob_usd_rate = 6.96
mxn_usd_rate = 19.10
mxn_amount = float(input('Input MXN: '))
usd_amount = mxn_amount / mxn_usd_rate
bob_amount = usd_amount * bob_usd_rate
print('BOB: '+ str(round(bob_amount, 2)))
@victoraguilarc
victoraguilarc / poolMetadata.json
Created July 12, 2021 04:21
DEV Pool metadata
{
"name": "DevPool",
"description": "Pool created by developer for developers",
"ticker": "DEV",
"homepage": "https://pool.devs.tools"
}
@victoraguilarc
victoraguilarc / monthly_payments.py
Created May 19, 2021 06:27
Calculate Total and IVA
from decimal import Decimal
from pprint import pprint
def cast_int(amount: Decimal) -> int:
return int(amount * 100)
def cast_decimal(amount: int) -> Decimal:
return Decimal(amount / 100).quantize(Decimal('1.00'))
class Product(models.Model):
# other fields
image = models.FileField(storage = MogileFSStorage(), upload_to = 'product_images')
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
product = Product()
# set all your variables here
product.save()
import Crypto.Cipher.AES
import Crypto.Random
import base64
import binascii
class Cipher_AES:
pad_default = lambda x, y: x + (y - len(x) % y) * " ".encode("utf-8")
unpad_default = lambda x: x.rstrip()
pad_user_defined = lambda x, y, z: x + (y - len(x) % y) * z.encode("utf-8")

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.