Skip to content

Instantly share code, notes, and snippets.

View skywinder's full-sized avatar
:octocat:

Petr Korolev skywinder

:octocat:
View GitHub Profile
@skywinder
skywinder / idea_native_clipboard_support
Last active August 29, 2015 14:15
idea_native_clipboard_support - for quickly fix idea.properties file
#!/usr/bin/env bash
if [ -n "$1" ]
then
if grep "ide.mac.useNativeClipboard=" "$1"/Contents/bin/idea.properties > /dev/null
then
if grep "ide.mac.useNativeClipboard=false" "$1"/Contents/bin/idea.properties > /dev/null
then
echo "ide.mac.useNativeClipboard=false found -> change to true"
@marcelofabri
marcelofabri / xopen
Last active July 11, 2016 21:34
Open .xcworkspace file if exists or .xcodeproj otherwise. Useful for CocoaPods users. Found it elsewhere, but I can't find it anymore.
#!/usr/bin/env ruby
require 'shellwords'
proj = Dir['*.xcworkspace'].first
proj = Dir['*.xcodeproj'].first unless proj
if proj
puts "Opening #{proj}"
`open #{proj}`
@cconway25
cconway25 / gist:7ff167c6f98da33c5352
Created August 11, 2014 15:06
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool.
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
# Step 2. Copy the framework structure to the universal folder
@idoru
idoru / aerobuild.sh
Created June 19, 2011 21:33
bump version, build & archive, tag git version and publish iOS app builds to testflight
#!/bin/sh
#
# aerobuild.sh
#
# What does this do?
# ==================
# - Bumps build numbers in your project using agvtool
# - Builds your app and packages it for testing/ad-hoc distribution
# - Commits build number changes to git
@EmmanuelOga
EmmanuelOga / commit-msg
Created June 13, 2012 22:01
commit-msg hook to add a prefix to commit messages
#!/usr/bin/env ruby
#
# Git commit-msg hook. If your branch name is in the form "US1234-postfix", or
# "US1234_postfix", it automatically adds the prefix "[US1234]" to commit
# messages.
#
# Example
# =======
#
# git checkout -b US1234-some-cool-feature
@skeeet
skeeet / xcode_ramdisk.sh
Created April 12, 2012 13:35 — forked from MaximKeegan/xcode_ramdisk.sh
Create a RAM disk for using with XCode
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
@maxme
maxme / raspberry-power-supply-check.sh
Last active August 5, 2023 06:45
Check your Raspberry pi power supply and USB cable
#!/bin/bash
# Before running this script, make sure you have sysbench installed:
# sudo apt-get install sysbench
#
# This script helps you check if your Raspberry pi is correctly powered.
# You can read more about Raspberry pi powering issues here: https://ownyourbits.com/2019/02/02/whats-wrong-with-the-raspberry-pi/
# If you're pi is correctly powered (stable power supply and quality cable), after running the script, you should get something like:
@claybridges
claybridges / gist:6029091
Last active October 10, 2023 14:26
UIInterfaceOrientationMask vs. UIInterfaceOrientation. As far as I know, a function like this isn't available in the API. I derived this from the enum def for UIInterfaceOrientationMask.
// UIInterfaceOrientationMask vs. UIInterfaceOrientation
// As far as I know, a function like this isn't available in the API. I derived this from the enum def for
// UIInterfaceOrientationMask.
inline BOOL OrientationMaskSupportsOrientation(UIInterfaceOrientationMask mask, UIInterfaceOrientation orientation) {
return (mask & (1 << orientation)) != 0;
}
@ffittschen
ffittschen / gitconfig.md
Last active January 3, 2024 08:40
Use IntelliJ or WebStorm as git mergetool with SourceTree

Use IntelliJ or WebStorm as git mergetool

Configure Sourcetree

The merge tool that ships with JetBrain's IntelliJ IDEA or WebStorm is really awesome and way better than FileMerge. It is quite simple to configure SourceTree to use it as the default mergetool:

  1. Open the SourceTree preferences and select the Diff tab
  2. Choose Custom both as Visual Diff Tool and as Merge Tool
  3. Paste the following commands into the textfields:
  • Diff Command: /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea diff
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)