Skip to content

Instantly share code, notes, and snippets.

@jourdein
jourdein / buildnumber
Last active December 15, 2015 03:49
Build number based on Git revision and incremented build number (the last number). The number separated by decimal. i.e. 121.5432
#!/bin/bash
git=/usr/local/git/bin/git
touch "${PROJECT_DIR}/${INFOPLIST_FILE}"
gitBuildNumber=`$git log --oneline | wc -l`
echo "#define BUILD_VERSION $gitBuildNumber" > NST/NST-InfoPlist.h
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
majorVersion=$gitBuildNumber
@jourdein
jourdein / gist:5412399
Last active December 21, 2016 01:35
Postgresql 9.1 On Ubuntu 12.10 Linux (Quantal Quetzal)
# STEP 1: VERIFY THAT YOU DO NOT ALREADY HAVE POSTGRESQL INSTALLED ON YOUR SYSTEM
ps ax | grep postgres
# STEP 2: INSTALL POSTGRESQL ON YOUR SYSTEM
sudo apt-get update
sudo apt-get install postgresql-9.1
# List All Postgres related packages
dpkg -l | grep postgres
@jourdein
jourdein / gist:5417250
Created April 19, 2013 00:25
Upgrade BASH using Brew on Mountain Lion
brew update
brew install bash
# Add this install of bash to the allowed shells list:
sudo bash -c "echo /usr/local/bin/bash >> /private/etc/shells"
# Homebrew installs things to /usr/local/Cellar/, then symlinks any binaries to /usr/local/bin, so you've now got the latest bash sitting at /usr/local/bin/bash
chsh -s /usr/local/bin/bash
@jourdein
jourdein / disabling_method.md
Last active August 29, 2015 14:02
Disabling method

unavailable

Add the unavailable attribute to the header to generate a compiler error on any call to init.

- (instancetype) init __attribute__((unavailable("init not available")));  

If you don't have a reason, just type __attribute__((unavailable)), or even __unavailable:

@jourdein
jourdein / gist:f8c6003bcc74ca88be8a
Last active August 29, 2015 14:02
List of Block Declaration Syntaxes

Blocks as Variables

Possibly the most common for of declaration.

return_type (^blockName)(var_type) = ^return_type (var_type varName)
{
    // ...
};
@jourdein
jourdein / gist:a143f41e6793bf373603
Last active August 29, 2015 14:05
List all fonts on iPhone | ARC
// List all fonts on iPhone
NSArray *familyNames = [UIFont familyNames];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily = 0; indFamily < familyNames.count; ++indFamily)
{
NSLog(@"Family name: %@", familyNames[indFamily]);
fontNames = [UIFont fontNamesForFamilyName:familyNames[indFamily]];
for (indFont = 0; indFont < fontNames.count; ++indFont)
{
@jourdein
jourdein / gist:fd19e9c3f764a33b6c59
Created March 28, 2015 11:16
Webby Angular-SEO
@jourdein
jourdein / deferLoading.js
Last active November 1, 2015 18:07
Defer loading js files companion script. Upon successfully parsed js files, re-run any function that has been attached to jquery ready function.
/**
* Was based on code: https://gist.github.com/miguel-perez/476046a42d229251fec3
*
* Replace jQuery's $.fn.ready() function with a mod exec
*
* Sites that make heavy use of the $(document).ready function
* are generally incompatible with asynchronous content.
*
*
* This script replaces the ready function with a
@jourdein
jourdein / install_psql_php.sh
Last active December 1, 2015 09:08
Install PHP pgSQL extensions on Mac OS X Yosemite (change PHP_VER with your PHP version) using postgres from Postgres.app
PHP_VER="5.5.14"
# Check if extension exists first
php -m | grep pgsql
# Update brew and install requirements
brew update
brew install autoconf
# Download PHP source and extract
@jourdein
jourdein / a quick way to deploy ruby on rails on vagrant.md
Created November 7, 2017 09:29 — forked from duleorlovic/a quick way to deploy ruby on rails on vagrant.md
Quickly deploy any Ruby on Rails application to VirtualBox using Vagrant or to any other provider of Linux machine just running this shell script

Deploy Ruby on Rails

You can use those bootstrap script to deploy your Rails application to Virtualbox. It's not intended to replace Chef or Puppet, but since its plain bash, its very readable and you can copy some lines and paste to your ssh session...

How to use

After installing Vagrant software run vagrant init and edit your Vagrantfile