Skip to content

Instantly share code, notes, and snippets.

View alex-ross's full-sized avatar

Alexander Ross alex-ross

View GitHub Profile
@alex-ross
alex-ross / elasticsearch@5.6.rb
Created November 12, 2021 21:50
Elasticsearch 5.6 on macOS arm64
class ElasticsearchAT56 < Formula
desc "Distributed search & analytics engine"
homepage "https://www.elastic.co/products/elasticsearch"
url "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.4.tar.gz"
sha256 "1098fc776fae8c74e65f8e17cf2ea244c1d07c4e6711340c9bb9f6df56aa45b0"
head do
url "https://github.com/elasticsearch/elasticsearch.git"
depends_on "gradle" => :build
end
@alex-ross
alex-ross / macOSHighSierra_Bootable.sh
Last active August 2, 2019 23:21
Create a Bootable macOSHighSierra.iso for installing macOS High Sierra in Virtualbox or VMware with macOS High Sierra.app
# Create a Bootable macOSHighSierra.iso for installing macOS High Sierra in Virtualbox or VMware with macOS High Sierra.app
# Create a "virtual USB flash drive"/disk image:
hdiutil create -o /tmp/HighSierra -size 8G -layout SPUD -fs HFS+J -type SPARSE
# Mount it:
hdiutil attach /tmp/HighSierra.sparseimage -noverify -mountpoint /Volumes/install_build
# Write the installer files into this new disk image:
@alex-ross
alex-ross / Gemfile
Last active December 26, 2018 20:18
Nanobox + Capybara + Rails + RSpec
# Gemfile
group :development, :test do
gem 'rspec-rails'
gem "capybara"
gem "selenium-webdriver"
end

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@alex-ross
alex-ross / mysql-docker.sh
Created August 3, 2017 08:13 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

Keybase proof

I hereby claim:

  • I am alex-ross on github.
  • I am aross (https://keybase.io/aross) on keybase.
  • I have a public key ASDPyzK_ROGPT4kF1IsoOIG3qMx4xOw3gme-3bbRElnEwgo

To claim this, I am signing this object:

# Converts exported json data to GH markdown pages for webbradion.net
# Must be runned from projects root directory and expects an file called 'e.json' to exists.
# e.json should be an JSON export of Episodes from Webbradions database.
require 'json'
require 'ostruct'
def content(e)
<<-EOF
---
@alex-ross
alex-ross / unit.js
Last active December 30, 2015 15:49
Example of unit.js file for karma in rails applications. This should allow tests to be written in both coffescript or javascript
/**
* Karma configuration
*
* Enables tests to be written in both javascript and coffeescript.
*
* Run your tests with: `karma start spec/karma/config/unit.js`
*
* Place your tests in similar paths: `spec/javascripts/<anydir>/<file>_spec.coffee`
* This file should be in: `spec/karma/config/unit.js`
*
/**
* Redirect unauthorized users to given path
* whenever any response returns http code 401.
*/
angular.module('RedirectUnauthorized')
.config(['$httpProvider', function($httpProvider) {
// Where should we redirect unauthorized users?
var loginPath = '/signin';
angular.module('LoadingIndicator', [])
.config(['$httpProvider', function ($httpProvider) {
var startLoadingIndicator = function() {
angular.element('.loading').text('Loading ...');
};
$httpProvider.responseInterceptors.push('HttpLoadingInterceptor');
$httpProvider.defaults.transformRequest.push(function (data, headersGetter) {
// On request start