Skip to content

Instantly share code, notes, and snippets.

@hugosenari
hugosenari / .gitconfig-alias
Last active January 11, 2019 17:14
git + jira(atlassian) + stash(atlassian)
# 'BNAME' = current branch name
# 'BDESC' = current branch description
# return the name of current branch
bname = rev-parse --abbrev-ref HEAD
# get/set description for current branch
bdesc = "!f() { BNAME=`git bname`; if [ $# -gt "0" ]; then BNAME=$1; fi; if [ $# -lt "2" ]; then git config branches.$BNAME.description; else git config branches.$BNAME.description \"$2\"; fi; }; f"
# create new branch with $1 as BNAME and $2 as BDESC, push to vp
@suvarshibhadra
suvarshibhadra / ssingleton.swift
Last active August 29, 2015 14:02
Swift Singleton
class CRBrandManagerSwift:NSObject
{
class func shared()->CRBrandManagerSwift{
struct Static{
static let s_manager = CRBrandManagerSwift();
}
return Static.s_manager;
}
}
@vinceallenvince
vinceallenvince / README.md
Last active July 2, 2024 15:12
CI with Travis, github Releases API, gh-pages and npm publish

CI with Travis, GitHub Releases API and gh-pages

When hosting a project on GitHub, it's likely you'll want to use GitHub Pages to host a public web site with examples, instructions, etc. If you're not using a continuous integration service like Travis, keeping your gh-pages site up to date requires continuous wrangling.

The steps below outline how to use Travis CI with GitHub Releases and GitHub Pages to create a "1-button" deployment workflow. After testing and running a release build, Travis will upload your release assets to GitHub. It will also push a new version of your public facing site to GitHub Pages.

Organize your project

Let's assume you are hosting a JavaScript project that will offer a single JavaScript file as a release asset. It's likely you'll organize your files like this.

@jonathan-beebe
jonathan-beebe / Xcode support newer iOS builds
Created October 26, 2015 15:59
Enable Xcode to support installing iOS apps on devices running newer version of iOS
- Go to newer version of Xcode, e.g. Xcode 7, in the Finder
- Right click and show package contents
- Navigate to `Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/`
- Copy the `9.0 (13A340)` folder
- Go to older version of Xcode, e.g. Xcode 6.4, in the Finder
- Right click and show package contents
- Navigate to `Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/`
- Paste the iOS 9 folder
- Restart Xcode
@martinbean
martinbean / pre-commit
Last active December 19, 2023 22:14
Pre-commit hook to detect if any .php files contain dd()
#!/usr/bin/php
<?php
$files = shell_exec('git diff-index --name-only --cached --diff-filter=ACMR HEAD | grep "\.php$"');
$files = explode("\n", trim($files));
$exitCode = 0;
foreach ($files as $file) {
if (empty($file)) {
@steipete
steipete / ios-xcode-device-support.sh
Last active May 11, 2025 13:30
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)