Skip to content

Instantly share code, notes, and snippets.

@ChezCrawford
ChezCrawford / parent.ex
Created February 11, 2021 18:32
ecto_validations
defmodule Parent do
use Ecto.Schema
import Ecto.Changeset
schema "parents" do
field :name, :string
embeds_one :child, Child do
field :name, :string
field :age, :integer
@ChezCrawford
ChezCrawford / Timeout.java
Created February 27, 2020 02:44
Stored Procedure Timeouts (SQL Server)
// SOURCE: https://techcommunity.microsoft.com/t5/sql-server-support/why-is-my-command-not-timing-out-jdbc/ba-p/317248
import java.sql.*;
public class Timeout {
public static void method1(CallableStatement c, int timeout) {
long start = System.currentTimeMillis();
long stop = 0;
@ChezCrawford
ChezCrawford / launch.json
Created February 9, 2017 18:50
VSCode TypeScript Configuration
{
// Use IntelliSense to find out which attributes exist for node debugging
// Use hover for the description of the existing attributes
// For further information visit https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// Debug a single Mocha test file and allow breakpoints to be set in the .ts file.
{
"type": "node2",
"request": "launch",
@ChezCrawford
ChezCrawford / app.js
Created September 15, 2016 15:39
Private Object Functions
'use strict'
let MyObject = require('./myObject');
let myObjectInstance = new MyObject('abc');
console.log(myObjectInstance.externalFunction());
@ChezCrawford
ChezCrawford / NotificationManager.js
Last active August 29, 2015 14:05
Sencha Touch Listeners in a Static Class
Ext.define('SenchaSandbox.util.NotificationManager', {
alternateClassName: 'NotificationManager',
requires: ['Ext.MessageBox'],
mixins: ['Ext.mixin.Observable'],
singleton: true,
constructor: function(config) {
this.initConfig(config);
@ChezCrawford
ChezCrawford / ViewWithDomEvents
Created May 20, 2014 12:42
Convert DOM Event to Custom Component Event in SenchaTouch
Ext.define('MyApp.view.ViewWithDomEvents', {
extend: 'Ext.Panel',
config: {
items:
[
{
xtype: 'button',
itemId: 'sampleButton'
}