Skip to content

Instantly share code, notes, and snippets.

View marclove's full-sized avatar

Marc Love marclove

View GitHub Profile
@marclove
marclove / .eslintrc
Created March 22, 2019 18:32
ESLint + Prettier + VSCode Configuration
{
"plugins": ["prettier"],
"extends": [
"plugin:prettier/recommended",
"plugin:jest/recommended"
],
"rules": {
// only rules that don't conflict with the rules declared in .prettierrc
}
// other eslint stuff
@marclove
marclove / DALLE-3 Prompt.md
Created October 27, 2023 13:59
DALLE-3 Prompt

Knowledge cutoff: 2022-01 Current date: 2023-10-05

Tools

dalle

// Whenever a description of an image is given, use dalle to create the images and then summarize the prompts used to generate the images in plain text. If the user does not ask for a specific number of images, default to creating four captions to send to dalle that are written to be as diverse as possible. All captions sent to dalle must abide by the following policies:
// 1. If the description is not in English, then translate it.
@marclove
marclove / proxy_methods.m
Created March 28, 2017 22:53
iOS 10.2 Appearance Proxy Methods
// iOS 10.2 APPEARANCE PROXY METHODS
// Generated thanks to Matt's gist: https://gist.github.com/mattt/5135521
// UIActivityIndicatorView
// ==========================
@property (nullable, readwrite, nonatomic, strong) UIColor *color NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
// UIBarButtonItem
// ==========================
(void)setBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
@marclove
marclove / docker-rebuild.sh
Created February 20, 2018 19:23
Docker Clean Rebuild
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi -f $(docker images -q)
docker-compose build
docker-compose up -d
class CommentsController
def create
comment = Comment.new(params[:comment])
@comment = CommentCreator.new(comment).create!
respond_with @comment
end
end
class CommentCreator
def initialize(comment)
@marclove
marclove / Date.swift
Created July 31, 2017 07:09
UIKit & Foundation Extensions
extension Date {
func add(_ value: Int, _ component: Calendar.Component) -> Date! {
let calendar = Calendar.current
return calendar.date(byAdding: component, value: value, to: self)
}
func subtract(_ value: Int, _ component: Calendar.Component) -> Date! {
let calendar = Calendar.current
return calendar.date(byAdding: component, value: -value, to: self)
}
@marclove
marclove / Platform.swift
Created July 30, 2017 09:00
iOS Platform Conditional
struct Platform {
static let isSimulator: Bool = {
var isSim = false
#if arch(i386) || arch(x86_64)
isSim = true
#endif
return isSim
}()
}
# Extend jQuery objects with Underscore collection methods.
#
# Each collection method comes in two flavors: one prefixed
# with _, which yields a bare DOM element, and one prefixed
# with $, which yields a jQuery-wrapped element.
#
# So if `this` is a jQuery object, instead of:
#
# _.max @, (el) -> $(el).height()
#
require 'active_support'
def parse_time(time_string, zone)
old_tz = Time.zone
begin
Time.zone = zone
Time.zone.parse(time_string)
ensure
Time.zone = old_tz
end

Keybase proof

I hereby claim:

  • I am marclove on github.
  • I am marclove (https://keybase.io/marclove) on keybase.
  • I have a public key ASCJPCH0w-Y-zetl_ke0CIXKYu58YpR4xLCz1sEB-53Bfwo

To claim this, I am signing this object: