Skip to content

Instantly share code, notes, and snippets.

View nbomberger's full-sized avatar

Nathaniel Bomberger nbomberger

View GitHub Profile
@nbomberger
nbomberger / dlf-detect-intent.js
Created November 17, 2018 19:08 — forked from nvtuan305/dlf-detect-intent.js
Detect Dialogflow intent that supports multiple agents using API v2
'use strict';
// @ts-ignore
const dialogflow = require('dialogflow');
const fs = require('fs');
/**
* Detect dialogflow intent
* @param {String} botId
* @param {String} sessionId
@nbomberger
nbomberger / macosx-configure-postfix-as-relay.md
Created September 20, 2018 12:28 — forked from loziju/macosx-configure-postfix-as-relay.md
Configure postfix as relay for OS X
@nbomberger
nbomberger / struct_vs_inheritance.swift
Created January 1, 2018 20:20 — forked from AliSoftware/struct_vs_inheritance.swift
Swift, Struct & Inheritance: How to balance the will of using Struct & Value Types and the need for Inheritance?
// #!Swift-1.1
import Foundation
// MARK: - (1) classes
// Solution 1:
// - Use classes instead of struct
// Issue: Violate the concept of moving model to the value layer
// http://realm.io/news/andy-matuschak-controlling-complexity/
@nbomberger
nbomberger / nginx.conf
Last active October 12, 2017 06:11
Example nginx configs with Rails 5.1 API only server
# Configure the reverse-proxy on port 443
# Supports CORS
# check it by running nginx -t -c nginx.conf
# restart nginx by runnging sudo service nginx restart
server {
# general configs
keepalive_timeout 30;
listen 127.0.0.1:443 ssl;
server_name api.example.com; # domain name goes here
@nbomberger
nbomberger / clear.txt
Created October 10, 2017 01:10 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@nbomberger
nbomberger / README.md
Created October 20, 2016 03:23 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@nbomberger
nbomberger / UITableView.swift
Created January 4, 2016 16:31 — forked from watert/UITableView.swift
UITableView example in iOS Playground with XCode 6 beta
// Playground - noun: a place where people can play
import UIKit
class ViewController: UIViewController ,UITableViewDelegate, UITableViewDataSource
{
var tableView: UITableView!
var items: NSMutableArray!
override func viewDidLoad() {
super.viewDidLoad()
//some time, frc section may be need section offset
@objc public protocol MFetchedResultsControllerOffsetSectionDelegate{
func offsetSection() -> Int
}
class MFetchedResultsController: NSFetchedResultsController, NSFetchedResultsControllerDelegate {
weak var viewController: UIViewController? //UITableViewController UICollectionViewController
weak var scrollView: UIScrollView? //TableView CollectionView
weak var offsetSectionDelegate: MFetchedResultsControllerOffsetSectionDelegate?
@nbomberger
nbomberger / Carthage Instructions.md
Last active August 29, 2015 14:27 — forked from pxlshpr/Carthage Instructions.md
These are the steps required to add and embed a framework into your project using Carthage.
  1. Add the URL of the framework's repo to your Cartfile using one of the following:
  github "ReactiveCocoa/ReactiveCocoa" # GitHub.com
  github "https://enterprise.local/ghe/desktop/git-error-translations" # GitHub Enterprise
  git "https://enterprise.local/desktop/git-error-translations2.git"
  git "/Users/user/foo/bar.git"

…optionally followed by one of the following version specifiers:

#import <QuartzCore/QuartzCore.h>
@interface ArrowLayer : CALayer
@property (nonatomic) CGFloat thickness;
@property (nonatomic) CGFloat startRadians;
@property (nonatomic) CGFloat lengthRadians;
@property (nonatomic) CGFloat headLengthRadians;
@property (nonatomic, strong) UIColor *fillColor;