Skip to content

Instantly share code, notes, and snippets.

View Blackjacx's full-sized avatar
👨‍💻
Coding

Stefan Herold Blackjacx

👨‍💻
Coding
View GitHub Profile

How to do codereview

Step 1: Context

Check what should have been done

Step 2: Git Changes

Check the related git commit

Step 3: Syntax Check

Check if the Dev use the right syntax and follow the styleguide

@Blackjacx
Blackjacx / installLinuxSoftwareStack.sh
Last active August 29, 2015 14:17
Install Linux Software Stack
## add keyring
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com <key>
## add: alternative keyserver
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys <key>
## chrome: manually from http://www.google.com/chrome/eula.html
## skype: manually from http://www.skype.com/download/skype/linux/
sudo apt-get install filezilla libxvidcore4 gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-ffmpeg gstreamer0.10-pitfdll libquicktime1 libxine1-plugins w32codecs libdvdread4 pidgin pidgin-facebookchat pidgin-hotkeys pidgin-libnotify pidgin-musictracker pidgin-plugin-pack pidgin-themes pidgin-sipe chmsee breathe-icon-theme dia googleearth miro rednotebook specto ubuntu-restricted-extras zim mplayer inkscape p7zip-full apt-show-versions libdvdcss vobcopy keepassx acroread tvtime wbar ubuntu-tweak texmaker vlc isomaster openssh-client openssh-server vim lsdvd une
@Blackjacx
Blackjacx / annotateAppIcon.sh
Created October 2, 2015 00:48
App Icon Annotation (version, build number, etc)
# check if tools installed
if ! type "composite" > /dev/null; then
exit 0
fi
IFS=$'\n'
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
PATH=${PATH}:/usr/local/bin
TARGET_PATH=${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
@Blackjacx
Blackjacx / getWWDCRessources.sh
Last active December 11, 2021 01:13
WWDC 2016 Ressource ( HD-, SD-Video, PDF ) Download Script
#!/bin/bash
#
# Bash script for downloading WWDC video and pdf ressources
# You can choose the year you're interested in by altering the variable YEAR (works only for 2014 until today).
#
# IMPORTANT
# Please install wget prior running this script since this tool is used to download the pdf's and videos. I use it
# since it is able to prevent re-downloading already existing content. So you can just run this script again and
# again and it will just download new content. This is really useful in the week of the WWDC since videos are
static func deviceAndVersionSpecificInformationAsString(userID: String?) -> String {
let processInfo = NSProcessInfo()
let byteCountFormatter = NSByteCountFormatter()
var data = Array<String>()
var systemComponents = Array<String>()
byteCountFormatter.countStyle = .Memory
byteCountFormatter.allowsNonnumericFormatting = false
data.append(UIDevice.versionString())
@Blackjacx
Blackjacx / UIView+AddingSubviews.swift
Created November 29, 2016 14:28
[iOS] Adding a subview maximized with insets
func addSubviewMaximized(subview: UIView, insets: UIEdgeInsets? = nil) {
let insets = insets ?? UIEdgeInsetsZero
let constraints: [NSLayoutConstraint] = [
subview.leftAnchor.constraintEqualToAnchor(leftAnchor, constant: insets.left),
subview.leftAnchor.constraintEqualToAnchor(leftAnchor, constant: -insets.right),
subview.topAnchor.constraintEqualToAnchor(topAnchor, constant: insets.top),
subview.bottomAnchor.constraintEqualToAnchor(bottomAnchor, constant: -insets.bottom),
]
subview.translatesAutoresizingMaskIntoConstraints = false
@Blackjacx
Blackjacx / UITextField-Replace-TextTheRightWay.swift
Last active December 28, 2023 17:18
UITextField - Replace Text The Right Way
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let strippedString = <change replacements string so it fits your requirement - strip, trim, etc>
// replace current content with stripped content
if let replaceStart = textField.position(from: textField.beginningOfDocument, offset: range.location),
let replaceEnd = textField.position(from: replaceStart, offset: range.length),
let textRange = textField.textRange(from: replaceStart, to: replaceEnd) {
textField.replace(textRange, withText: strippedString)
@Blackjacx
Blackjacx / pdfify_scanned_documents.sh
Last active May 20, 2017 14:09
Converts all tifs in the current directory to black and white and merges them into a single pdf
#/bin/bash
EXT="tif"
# use xargs to trim whitespaces
COUNT=`ls -1 *.$EXT 2>/dev/null | wc -l | xargs`
THRESHOLD="50%"
# check if there are files of the specified extension
if [ $COUNT != 0 ]
then
echo "Converting $COUNT $EXT's to black and white and merge them to one PDF..."
@Blackjacx
Blackjacx / XCUIElement+ClearAndEnterText.swift
Created February 12, 2018 13:55
XCUIElement+ClearAndEnterText
extension XCUIElement {
/**
Removes any current text in the field before typing in the new value
- Parameter text: the text to enter into the field
*/
func clearAndEnterText(text: String) {
defer {
self.typeText(text)
}
@Blackjacx
Blackjacx / iOS-Parallax-Effect.swift
Created March 31, 2022 08:37
iOS Parallax Effect as UIView Extension
extension UIView {
func applyParallax() {
let amount = 10
let horizontal = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis)
horizontal.minimumRelativeValue = -amount
horizontal.maximumRelativeValue = amount
let vertical = UIInterpolatingMotionEffect(keyPath: "center.y", type: .tiltAlongVerticalAxis)