Skip to content

Instantly share code, notes, and snippets.

View getaclue00's full-sized avatar

Alex getaclue00

View GitHub Profile
@kharrison
kharrison / SwiftIntegerGuide.swift
Created February 17, 2017 16:43
Swift Integer Quick Guide
// -------------------------------------
// Swift Integer Quick Guide
// -------------------------------------
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
@kharrison
kharrison / CoreDataController.swift
Last active January 31, 2023 22:36
Swift wrapper for NSPersistentContainer - Easy Core Data Setup with iOS 10
//
// CoreDataController.swift
//
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright
@wrburgess
wrburgess / 1_add_activable_fields_to_model.rb
Last active March 19, 2018 00:01
Activatable concern for Rails 5
class AddActivatableFieldsToModel < ActiveRecord::Migration[5.0]
def change
add_column :users, :archived, default: false
add_column :users, :test, default: false
add_column :users, :dummy, default: false
add_index :users, :archived
end
end
@nitrag
nitrag / Screenshot.swift
Created November 21, 2016 05:16
This will allow you to take a screenshot of a UIView, but more importantly only a section of that view
//
// Screenshot.swift
//
// 1) Take a picture of a UIView
// 2) Take a picture of a UIView's subframe. EG. Fullscreen UIView with a
// small square box in the middle, it will only save what's visible in the box frame
// but not the box itself
import Foundation
import UIKit
@nrollr
nrollr / MongoDB_macOS_Sierra.md
Last active April 1, 2024 16:23
Install MongoDB on Sierra using Homebrew

Install MongoDB on macOS Sierra

This procedure explains how to install MongoDB using Homebrew on macOS Sierra 10.12.
Official MongoDB install documentation: here

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@mminer
mminer / ScreenshotManager.swift
Last active May 23, 2018 22:28
Saves screenshots in a Cocoa application (wrapper around screencapture).
import AppKit
struct ScreenshotManager {
/// Matches macOS' screenshot filename format.
private static let filenameFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "'Screen Shot' yyyy-MM-dd 'at' HH.mm.ss"
return formatter
}()
@dtolb
dtolb / node-docs.md
Last active May 6, 2019 09:29
Generate Docs

Deploy JsDoc to Github pages

Tools

Install

npm install minami --save-dev npm install jsdoc --save-dev

const os = require("os");
const fs = require("fs");
const Emitter = require('events');
var wslNetworkInterfaces = function() {
console.log("WSL has no idea what interfaces are available.");
return {
"Loopback Pseudo-Interface 1": [
{
"address": "::1",
@stinger
stinger / Swift3DataTaskDelegate.swift
Last active March 25, 2023 22:12
Swift 3: URLSessionDelegate
//: # Swift 3: URLSessionDelegate
//: The following example shows how to use `OperationQueue` to queue the network requests. This is useful in many ways (for delaying queued requests when the networking goes down for example)
import Foundation
import PlaygroundSupport
class Requester:NSObject {
let opQueue = OperationQueue()
var response:URLResponse?
@takuoka
takuoka / AutoGrowingTextField.swift
Last active January 18, 2022 13:02
Example of an NSTextField that expands its height automatically. https://github.com/DouglasHeriot/AutoGrowingNSTextField
import Cocoa
// https://github.com/DouglasHeriot/AutoGrowingNSTextField
// for AutoLayout
class AutoGrowingTextField: NSTextField {
var minHeight: CGFloat? = 100