Skip to content

Instantly share code, notes, and snippets.

View pepicrft's full-sized avatar
🌱
Open-sourcing

Pedro Piñera Buendía pepicrft

🌱
Open-sourcing
View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
attachments: parent_id, asset_id
domain_names: organisation_id
event_memberships: user_id, event_id
events: editor_id
group_actions: user_id, group_id
groups: user_id
icons: parent_id
invitations: sender_id
legacy_actions: item_upon_id
news_items: author_id
@olivierlacan
olivierlacan / launch_sublime_from_terminal.markdown
Created September 5, 2011 15:50
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@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)
@pcanterini
pcanterini / octopress deploy
Last active March 4, 2017 01:43
fix for octopress deploy - rake deploy is rejected
git clone https://github.com/username/username.github.io.git
git checkout source
Then we need to setup the deploy directory.
mkdir _deploy
cd _deploy
git init
git remote add -t master -f origin https://github.com/username/username.github.io.git
Done! Now we can make changes in source branch and use rake gen_deploy as usual.
@frowing
frowing / gist:8575251
Last active January 12, 2017 10:58
Remove Caches and Preferences directory on the latest used Simulator app so it gets rebooted to its initial state.
#!/bin/bash
simulatorDirectory="$HOME/Library/Developer/CoreSimulator/Devices"
latestSimulator=$(ls -Ft "$simulatorDirectory"| grep / | head -1)
applicationsDirectory="$simulatorDirectory""/""$latestSimulator/Applications/"
latestApp=$(ls -t "$applicationsDirectory" | head -1)
appDirectory="$applicationsDirectory""/""$latestApp"
libraryDirectory="$appDirectory/Library"
prefDir="$libraryDirectory/Preferences"
cachesDirectory="$libraryDirectory/Caches"
//
// NaturalMotion.swift
//
// Created by Maciej Swic on 2014-06-06.
// Released under the MIT license.
//
import UIKit
extension UIView {
@dfreniche
dfreniche / swift.sh
Created August 28, 2014 06:07
Bash script to launch swift from command line, with all Xcode6-Betas around
#!/bin/bash
# swift.sh: Bash script to launch swift from command line
# it works even with Xcode5 and several Xcode-Beta installed
NEW_XCODE=$(ls -m1 -d /Applications/Xcode6* | tail -r -n 1)/Contents/Developer
echo using $NEW_XCODE
$NEW_XCODE/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -sdk $NEW_XCODE
@micho
micho / gist:855b272d2f408f04729e
Last active October 9, 2015 14:08
Github PRs: Collapse/expand file
// Add a button to Collapse or Expand files in a Github PR
//
// See it in action: http://cl.ly/image/1r3q3d0d3b0p
//
// Install Tampermonkey and add this as a script
// ==UserScript==
// @name Github PRs: Collapse/expand file
// @namespace https://gist.github.com/micho/855b272d2f408f04729e
// @version 0.1
@soffes
soffes / Rakefile
Last active August 30, 2024 10:10
Programmatically build and sign a Developer ID macOS app
TEAM_ID = 'XXXXXXXXXX'
APP_NAME = 'My App'
SCHEME_NAME = APP_NAME
desc 'Create a beta build'
task :build do
# Ensure clean git state
unless system 'git diff-index --quiet HEAD --'
abort 'Failed. You have uncommitted changes.'
end