This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "header.h" | |
std::string A::name = "David"; | |
std::string surname = "Gavilan"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (C) 2012 David Gavilan Ruiz | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH TH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cheese: Equatable { | |
static func == (lhs: Cheese, rhs: Cheese) -> Bool { | |
return lhs.rating == rhs.rating | |
} | |
let rating : Int | |
init(rating: Int) { | |
self.rating = rating | |
} | |
} | |
/// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ==(lhs: Bread, rhs: Bread) -> Bool { | |
return lhs.rating == rhs.rating | |
} | |
b1 == b2 // true | |
func ==(lhs: Cheese, rhs: Cheese) -> Bool { | |
return lhs.rating == rhs.rating | |
} | |
c1 == c2 // true | |
c1 == c4 // false | |
cheeses.contains(c1) // still an error! not Equatable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Bread { | |
let rating : Int | |
} | |
class Cheese { | |
let rating : Int | |
init(rating: Int) { | |
self.rating = rating | |
} | |
} | |
var c1 = Cheese(rating: 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum SerializationError: Error { | |
case missing(String) | |
case invalid(String, Any) | |
} | |
// in some deserialization code | |
// ... | |
guard let vertexData = json["vertices"] as? [NSNumber] else { | |
throw SerializationError.missing("vertices") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Copy to ~/Library/Application\ Support/GIMP/2.10/scripts/ | |
;; Ref. https://stackoverflow.com/a/24164916/1765629 | |
;; Usage example: | |
;; gimp -i -b '(layers-to-psd (list "Background.jpg" "A.png" "B.png") "compo.psd")' -b '(gimp-quit 0)' | |
;; | |
(define (layers-to-psd image-paths psd-path) | |
(define (add-layers image image-paths) | |
(when (not (null? image-paths)) | |
(let* | |
( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# e.g. | |
# ./s3move.sh -d Images/all/ "15-36-58" "15-54-27" Captures/iPhone6/ | |
DEBUG= | |
BUCKET=screenshots | |
PREFIX=Screenshot_ | |
EXT=".png" | |
while getopts ":db:p:e:" opt; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -Wall -o multiple multiple.cpp | |
#include <iostream> | |
// Based on this answer: | |
// https://stackoverflow.com/a/2005142 | |
// I renamed methods for a serialization example. | |
// In this example, there's a "Unicorn" class that knows how to doA and doB, | |
// but user of the respective interfaces do not expect B to get serialized | |
// when they try to serialize A. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Still undocumented here https://developer.apple.com/support/app-previews/ | |
# or here https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/Properties.html | |
# but iPhoneX App Previews required size is 886x1920 | |
# Unfortunately, iMovie seems to be dumb and creates a 750x1334 App Preview video from your iPhoneX capture | |
# -- and with black margins on the side | |
# So you need to crop & scale the video up before you submit it to iTunesConnect: | |
ffmpeg -i iPhoneX-iMovie.mp4 -filter:v "crop=616:1334:68:0" -c:a copy cropped.mp4 | |
ffmpeg -i cropped.mp4 -vf scale=886:1920 -c:a copy iPhoneX-final.mp4 |
NewerOlder