Skip to content

Instantly share code, notes, and snippets.

View brutuscat's full-sized avatar

Mauro Asprea brutuscat

View GitHub Profile
@brutuscat
brutuscat / README.md
Last active January 1, 2016 22:19
[SOLVED] How to solve Maverick's beach ball of death recurrent issues?

Solving OSX Maverick's beach ball of death issues

  • Make sure you re-enable Trim support in your SSD
  • Disable memory compression mechanisms:
sudo nvram boot-args="vm_compressor=1"
@brutuscat
brutuscat / README.md
Last active January 1, 2016 15:19
Instructions and patch to compile MAME 0.151 in OSX using Homebrew
@brutuscat
brutuscat / README.md
Created December 16, 2013 17:38
focus-on directive that will listen $on the event emitted and will focus the element when event is triggered

Example usage:

In a template:

<element focus-on="modelUpdated">
</element>

In a controller:

@brutuscat
brutuscat / README.md
Last active December 31, 2015 10:39
Codeception auto tests setup using ruby's Guard

Codeception auto tests setup using ruby's Guard

Instructions

  • Drop the Gemfile and the Guardfile in your project
  • Run bundle install
  • Run bundle exec guard
@brutuscat
brutuscat / cantor.php
Created July 11, 2013 18:30
PHP Cantor implementation using BCMath extension
<?php
# Need Composer with PHPUnit
require 'vendor/autoload.php';
function cantor($x, $y)
{
// ((x + y) * (x + y + 1)) / 2 + y;
return bcadd(bcdiv(bcmul(bcadd($x, $y), bcadd(bcadd($x, $y), 1)), 2), $y);
}
@brutuscat
brutuscat / gist:5858480
Last active December 18, 2015 22:59
Codeception #waitForAjax helper method
<?php
public function waitForAjax() {
$timeoutMicroSeconds = 2000000;
$isAjaxActive = '
var isAngularAjaxActive = false;
try {
var http = angular.element(".ng-scope").injector().get("$http");
isAngularAjaxActive = !!(http.pendingRequests.length);
}
getCurrentRange = function () {
var sel = window.getSelection();
var active = document.activeElement;
if (editor[0] == active && sel.getRangeAt && sel.rangeCount) {
return sel.getRangeAt(0);
}
},
@brutuscat
brutuscat / gist:3996338
Created November 1, 2012 20:37
config.ru
# encoding: UTF-8
# config.ru
require 'rack'
require 'haml'
require 'haml_file'
app = proc do |env|
HamlFile.new('views').call(env)
end
@brutuscat
brutuscat / gist:3996311
Created November 1, 2012 20:34
dotcloud.yml
www:
type: ruby
exclude_bundler_groups:
- development
config:
ruby-version: 1.9.3
# ws:
# type: custom
@brutuscat
brutuscat / gist:3919594
Created October 19, 2012 17:47
Variable set to properly compile MRI ruby in Mountain Lion
CONFIGURE_OPTS='--with-openssl-dir=/opt/local --with-opt-dir=/opt/local'