Skip to content

Instantly share code, notes, and snippets.

View alexandru-calinoiu's full-sized avatar
💭
Crafting

Calinoiu Alexandru Nicolae alexandru-calinoiu

💭
Crafting
View GitHub Profile
@dmarcato
dmarcato / strip_play_services.gradle
Last active December 21, 2022 10:10
Gradle task to strip unused packages on Google Play Services library
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
class Foo
def self.foo
"foo"
end
def foo
"ifoo"
end
def true_foo
Foo.foo
end
@jm
jm / gist:2368029
Created April 12, 2012 15:13
Talk proposal
[rubyist learn:@"Cocoa" withLanguage:@"MacRuby"];
-------------------------------------------------
Cocoa is a fantastic set of libraries to work with, but Objective-C can be a bit of a verbose beast. MacRuby offers Rubyists a great way to use the whole framework, but with a beautiful, developer friendly language.
The only catch is that idiomatic Cocoa is kind of weird for a Rubyist. What's a delegate? Aren't we not supposed to use threads in Ruby? It gets even dicier if one decides to write a GUI application, since most of us are writing web apps and don't encounter the concept of a run loop and don't worry about blocking the main thread for users typically. Why is this API so ugly? The unfamiliarity with the assumptions and idioms underlying MacRuby can make it just as hard (or harder!) to pick up.
This talk is a solution for the confusion. We'll take 6 core Cocoa concepts and look at what they are, how they're used in Cocoa, and use MacRuby to show their usage. We'll look at:
* Syntax (patter
@alexandru-calinoiu
alexandru-calinoiu / SleepSort
Created February 10, 2012 09:53
A C# implementation of Sleep Sort inspired by this talk http://www.infoq.com/presentations/Cool-Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace SleepSort
{
class Program
{
@rolo
rolo / gist:1481128
Created December 15, 2011 13:44
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
$ irb
>> require 'active_support/core_ext/numeric/time'
=> true
>> 1.hour.ago
NoMethodError: undefined method `current' for Time:Class
from /Users/rando/.rvm/gems/ree-1.8.7-2011.03@core/gems/activesupport-3.0.5/lib/active_support/duration.rb:68:in `ago'
from (irb):2
>> require 'active_support/core_ext/time/calculations'
=> true
>> 1.hour.ago