Skip to content

Instantly share code, notes, and snippets.

View jackd942's full-sized avatar

Jack Davis jackd942

View GitHub Profile
@jackd942
jackd942 / DAButton.swift
Created February 27, 2016 20:39
Custom IBDesignable and IBInspectable UIButton created for use in the Devslopes App
//
// DAButton.swift
//
// Created by Jack Davis on 2/20/16.
// Copyright © 2016 Nine-42 LLC. All rights reserved.
//
// Custom UIButton class designed for Devslopes App.
//
//
@jackd942
jackd942 / DAPolyButton.swift
Created February 27, 2016 20:41
Custom IBDesignable and IBInspectable Polygon UIButton created for use in the Devslopes App
//
// DAPolyButton.swift
//
// Created by Jack Davis on 2/21/16.
// Copyright © 2016 Nine-42 LLC. All rights reserved.
//
import UIKit
@IBDesignable
@jackd942
jackd942 / DATextField.swift
Last active November 20, 2017 12:45
Custom IBDesignable and IBInspectable UITextField created for use in the Devslopes App
//
// DATextField.swift
// devslopes-app
//
// Created by Jack Davis on 2/26/16.
// Copyright © 2016 Devslopes. All rights reserved.
//
import UIKit
@jackd942
jackd942 / CGFloatExt.swift
Created February 27, 2016 20:54
Extension to CGFloat for use in Devslopes App
//
// CGFloatExt.swift
// devslopes-app
//
// Created by Jack Davis on 2/21/16.
// Copyright © 2016 Devslopes. All rights reserved.
//
import UIKit
@jackd942
jackd942 / ColorExt.swift
Last active March 21, 2016 16:30
Extension to UIColor for use in Devslopes App
//
// Color+DAButton.swift
//
// Created by Jack Davis on 2/21/16.
// Copyright © 2016 Nine-42 LLC. All rights reserved.
//
import UIKit
@jackd942
jackd942 / dupe-finder.js
Created January 17, 2017 19:27 — forked from chrisckchang/dupe-finder.js
Aggregation query to find duplicate key values
// Desired unique index:
// db.collection.ensureIndex({ firstField: 1, secondField: 1 }, { unique: true})
db.collection.aggregate([
{ $group: {
_id: { firstField: "$firstField", secondField: "$secondField" },
uniqueIds: { $addToSet: "$_id" },
count: { $sum: 1 }
}},
{ $match: {
@jackd942
jackd942 / _ticket-control.js
Created April 22, 2018 23:25 — forked from dmeents/_ticket-control.js
How to create a React.js ticketing system using Redux-Form and a MongoDB
//server/controllers/_ticket-control.js
'use strict';
const Tickets = require('../models/tickets');
//===================
// Create Tickets Route
//===================
exports.createTicket = function(req, res, next) {

Keybase proof

I hereby claim:

  • I am jackd942 on github.
  • I am jackd942 (https://keybase.io/jackd942) on keybase.
  • I have a public key ASDnCCzRsyWAYGUfrc1AZOhuZS0_PIzH7f1N5LN6zCz0jAo

To claim this, I am signing this object:

@jackd942
jackd942 / slice_length_capacity.go
Created December 2, 2018 17:05
Slice length and capacity
package main
import "fmt"
func main() {
s := []int{2, 3, 5, 7, 11, 13}
printSlice(s)
// Slice the slice to give it zero length
s = s[:0]
@jackd942
jackd942 / gist:3fb67c79b30e15ea3701431d327ad3f7
Created July 17, 2019 01:26 — forked from arjunvenkat/gist:1115bc41bf395a162084
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.