View gist:291cd48e677beb1ded29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace the SHAs and author with your own. | |
git log --numstat --pretty="%H" --author="eduardo.a20" 8e03890e494a25e7706c80c38e89858c887d436d..052ff1202e0326c9588531d234b30269bd8056f8 | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}' |
View gist:bae0d45f0abffda1731b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
portalServidorApp.controller('UnidadeController', ['$scope', 'resolvedUnidade', 'Unidade', | |
function ($scope, resolvedUnidade, Unidade) { | |
$scope.unidades = resolvedUnidade; | |
$scope.create = function () { | |
Unidade.save($scope.unidade, | |
function () { |
View currentquery.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM ( | |
SELECT raw_sql_.*, rownum raw_rnum_ | |
FROM (SELECT "LANCAMENTOS".* FROM "LANCAMENTOS" ) raw_sql_ | |
) | |
WHERE raw_rnum_ between 1 and 30 | |
---------------------------------------------------------------------------------- | |
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | | |
----------------------------------------------------------------------------------- |
View loclco.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.doStuff = function(attrs) { | |
if($rootScope.stuffLocked) { | |
return; | |
} | |
$rootScope.stuffLocked = true; | |
// load stuff, etc | |
$rootScope.stuffLocked = false; | |
View cached.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.switchFolder = function(attrs) { | |
// Results found on the last query will be available instantly (if any) | |
// you could also add a Message.is_query_cached to check if there are cached results | |
$scope.messages = Message.query_cached({ id: attr.some_id}); | |
// Lets find the actual results, which can take longer | |
var messages = Message.query({ id: attr.some_id}, function () { | |
$scope.messages = message; | |
}); |
View gist:4691440
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
unless html_tag =~ /^<label/ | |
errors = Array(instance.error_message).join(',') | |
%(<div class="error">#{html_tag}<small class="error"> #{errors}</small></div>).html_safe | |
else | |
%(<div class="error">#{html_tag}</div>).html_safe | |
end | |
end |
View gist:4634649
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.anual(fc0, fcj, n, d0, dj0) | |
fc0 = fc0.to_f | |
fcj = fcj.to_f | |
dn = dj0 >> n | |
dias = (dn - dj0).to_i | |
cet = 0 | |
while true | |
total = 0.0 | |
n.times do |j| |
View twblock.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'twitter' | |
Twitter.configure do |config| | |
config.consumer_key = 'trololol' | |
config.consumer_secret = 'trololol' | |
config.oauth_token = 'trololol-trololol' | |
config.oauth_token_secret = 'trololol' | |
end | |
begin |
View gist:1873995
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int count = 1; | |
while ( [[NSFileManager defaultManager] fileExistsAtPath:[self filePath]] ) { | |
NSRegularExpression *regex = | |
[NSRegularExpression regularExpressionWithPattern:@"\\s\\(\\d\\)" | |
options:NSRegularExpressionCaseInsensitive | |
error:NULL]; | |
NSString* str = [regex stringByReplacingMatchesInString:self.name | |
options:0 |
View gist:1108424
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
has_many :actions | |
end | |
class Actions < ActiveRecord::Base | |
belongs_to :movie | |
belongs_to :user | |
# add a scope called twitted - it's just a where!!! | |
end |
NewerOlder