Skip to content

Instantly share code, notes, and snippets.

View marclove's full-sized avatar

Marc Love marclove

View GitHub Profile
@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 / .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 / 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
@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
}()
}
@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;
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:

@marclove
marclove / angularjs_directive_attribute_explanation.md
Created January 29, 2016 08:08 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@marclove
marclove / gist:e93feefc1e72c663acb9
Created April 14, 2015 23:55
Xcode Build Script to automatically set Version & Build Number
git=$(sh /etc/profile; which git)
latest_tag=$("$git" describe --tags --always --abbrev=0)
version_string="${git_release_version#*v}" # assumes the following tag format: v1.2.3
number_of_commits=$("$git" rev-list <$$$$$$-YOUR DEVELOPMENT BRANCH NAME HERE-$$$$$$> | wc -l | tr -d ' ')
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"
for plist in "$target_plist" "$dsym_plist"; do
if [ -f "$plist" ]; then
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $number_of_commits" "$plist"