Skip to content

Instantly share code, notes, and snippets.

View leapingbytes's full-sized avatar

Andrei Tchijov leapingbytes

View GitHub Profile
@leapingbytes
leapingbytes / Dockerfile
Created May 2, 2019 14:32
Dockerizing simple c# app
FROM microsoft/dotnet:2.2-sdk as sdk
# RUN dotnet tool install -g dotnet-warp
RUN curl -Lo /root/warp-packer https://github.com/dgiagio/warp/releases/download/v0.3.0/linux-x64.warp-packer
RUN chmod +x /root/warp-packer
RUN mkdir /build
COPY Program.cs MyApp.csproj /build/
WORKDIR /build
RUN dotnet restore

Twilio errors

Start Verification

POST https://api.authy.com/protected/json/phones/verification/start

When... Example... Error code Response is...
all is well {
"country_code": "84",
"phone_number": "0866742932",
"via" : "sms"
}
{
"carrier": "Viettel Mobile",
"is_cellphone": true,
"message": "Text message sent to +84 86-674-2932.",
"seconds_to_expire": 599,
"uuid": "b07107c0-47be-0137-910b-0a4259707972",
"success": true
}
parameter missing { "phone_number": "0866742932", "via" : "sms"} 60004 { "error_code": "60004", "message": "Invalid parameter: country_code - Parameter is required", "errors": { "message": "Invalid parameter: country_code - Parameter is required" }, "success": false}
@leapingbytes
leapingbytes / AbstractSql2oTestBase.java
Last active March 28, 2019 05:42
H2 (MySQL) + Flyway + Sql20
package co.vgw.pok.customer.persistence.sql20;
import java.sql.SQLException;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.configuration.FluentConfiguration;
import org.h2.tools.Server;
import org.sql2o.Sql2o;
public abstract class AbstractSql2oTestBase {
@ApplicationScoped
public class EmailValidatorImpl implements EmailValidator {
private static final Logger log = Logger.getLogger(EmailValidatorImpl.class);
@Inject
KickboxApi kickboxApi;
...
@Override
@leapingbytes
leapingbytes / AMQWx-conf-activemq.xml
Created September 14, 2015 01:01
ActiveMQ 5.12 + Wildfly 8.2
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
@leapingbytes
leapingbytes / fails
Created October 8, 2014 10:32
@schedule annotation produces "Cannot invoke timeout method because method null is not a timeout method" upon second and all consecutive executions
@Singleton
@Startup
public class SettingsManagerImpl implements SettingsManager {
...
@Schedule(hour = "*", minute = "*", second="13")
public void checkSettingsProviders() {
...
}
...
}
@leapingbytes
leapingbytes / Overview
Created August 6, 2014 13:43
Workaround for UNDERTOW-282
This solution is based on comment https://issues.jboss.org/browse/UNDERTOW-282?focusedCommentId=12986535&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12986535
This fix was tested with Wildfly 8.1.0 Final.
NOTE: io.undertow.servlet.ServletExtension file should go into META-INF/services/io.undertow.servlet.ServletExtension
@leapingbytes
leapingbytes / gist:949b34ac7bd83965233f
Created July 12, 2014 11:28
How to make Wildfly send "Connection: close" instead of "Connection: keep-alive"
<subsystem xmlns="urn:jboss:domain:undertow:1.1">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" always-set-keep-alive="false"/>
<https-listener name="default-s" socket-binding="https" security-realm="UndertowRealm" always-set-keep-alive="false"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<access-log prefix="access"/>
<filter-ref name="connection-close"/>
<filter-ref name="server-header"/>
@leapingbytes
leapingbytes / gist:6832881
Created October 4, 2013 21:13
this seems to work. it reports reasonable attributes. for example for bold + italic: attributes : name : content attributes : font-style : italic attributes : color : #ffffff attributes : b : attributes : i : attributes : font-weight : bold attributes : font-family : Arial attributes : font : size=3 color=#ffffff face=Arial attributes : font-siz…
Caret cr = me.reachTextField.getCaret();
int position = cr.getDot()
Element e = me.reachTextField.getStyledDocument().getCharacterElement(position);
AttributeSet attributes = e.getAttributes();
Enumeration attributeNames = attributes.getAttributeNames();
while(attributeNames.hasMoreElements()) {
Object name = attributeNames.nextElement();
System.out.println("attributes : " + name + " : " + attributes.getAttribute(name));
}
@leapingbytes
leapingbytes / SqlJoinProxy.js
Created August 28, 2013 06:59
Extension to Ext.data.proxy.Sql to allow specifying JOINs You are free to use this code in any of your projects (open source or otherwise). I would appreciate if you mentioned my name (Andrei Tchijov @ Leaping Bytes, LLC) if you do.
Ext.define('LB.store.SqlJoinProxy', {
alias: 'proxy.sqljoin',
extend: 'Ext.data.proxy.Sql',
config: {
/**
* config below will join table image ON image_id = i.id and will select field image_thumbnail as thumbnail and
* field image_full_size as full_size
*
* joins: [{