Skip to content

Instantly share code, notes, and snippets.

View tlarevo's full-sized avatar

Tharindu Abeydeera tlarevo

View GitHub Profile
@tlarevo
tlarevo / register_and_login_user.ex
Last active April 10, 2024 14:58
create and login separate user for scenario testing
defp register_and_log_user() do
# Create a user and register user
partner_user = user_fixture()
# Log in the user
conn = log_in_user(Phoenix.ConnTest.build_conn(), partner_user)
[partner_conn: conn, partner_user: partner_user]
end
@tlarevo
tlarevo / typography.ex
Last active March 14, 2024 09:52
typography snippet
<%!-- <.typography variant="strong" class="text-xs font-semibold my-0 text-slate-50">
Personal Consultant
</.typography> --%>
@tlarevo
tlarevo / challenge.rb
Created August 10, 2023 05:26
Solving a challenge
require 'uri'
require 'net/http'
require 'json'
require 'cgi'
module Challenge
# Evaluate the uri, parse the payload and return updated uri or nil if
# payload does not have 'follow' key
def self.check_uri(uri)
response = Net::HTTP.get_response(uri)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Fuse 1.0.0 (build 13426)
Configuring (0.8 s)
Compiling syntax tree (2.8 s)
Generating code and data (9.0 s)
Building Android app
2/2: vxSelfcare.apk
FAILURE: Build failed with an exception.
* What went wrong:
@tlarevo
tlarevo / Kafka default configurations.conf
Last active June 7, 2016 11:09
Default Kafka configurations
advertised.host.name = null
metric.reporters = []
quota.producer.default = 9223372036854775807
offsets.topic.num.partitions = 50
log.flush.interval.messages = 9223372036854775807
auto.create.topics.enable = true
controller.socket.timeout.ms = 30000
log.flush.interval.ms = null
principal.builder.class = class org.apache.kafka.common.security.auth.DefaultPrincipalBuilder
replica.socket.receive.buffer.bytes = 65536
@tlarevo
tlarevo / php-compatible-swift-aes-encryption-using-cryptoswift.swift
Last active January 5, 2022 15:59
PHP compatible AES Encryption and Decryption with Swift and CryptoSwift
// Credit should be given to;
// https://gist.github.com/yutelin/f4f66e0c78474db1de51#file-string-aes-swift
// https://gist.github.com/bradbernard/2a7af4c2200cb3794768#file-swift-encryption
// And most importantly to https://github.com/krzyzanowskim/CryptoSwift
import Foundation
import CryptoSwift
extension String {
@tlarevo
tlarevo / swift-compatible-php-aes-encryption-using-mcrypt.php
Last active January 5, 2022 15:59
Swift compatible AES Encryption and Decryption with PHP and mcrypt
<?php
// Credit should be given to;
// https://gist.github.com/bradbernard/7789c2dd8d17c2d8304b#file-php-encyrption
// https://gist.github.com/krzyzanowskim/043be69ab3ba9fd5ba58#file-encryptaeswithphp
$data = '{"verification_code":"123456"}';
$key = '1234567890123456';
function aesEncrypt($data, $key) {
$data = addPadding($data);
log4j.main = {
// Example of changing the log pattern for the default console appender:
//
def layout = new PatternLayout("%d [%t] %-5p %c{1} %x - %m%n")
def logName = { String baseName -> "logs/${appName}-${baseName}.log" }
appenders {
console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
appender new DailyRollingFileAppender(
@tlarevo
tlarevo / request_response.json
Created May 11, 2015 16:14
Request response JSON Object
{
account_type: '',
product_category: '',
identification: {
type: '',
value: ''
},
personal_details: {
title : '',
name_with_initials : '',