Skip to content

Instantly share code, notes, and snippets.

View taq's full-sized avatar

Eustáquio Rangel taq

View GitHub Profile
@taq
taq / gist:ae0e323786a41cfc237c
Created September 17, 2014 10:38
Plugins do Vim que eu uso
ag.vim
bufexplorer
camelcasemotion
ctrlp.vim
emmet-vim
L9
limelight.vim
nerdcommenter
nerdtree
syntastic
@taq
taq / nginx
Created April 21, 2014 00:47
Nginx Ubuntu service
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@taq
taq / gist:10663010
Created April 14, 2014 16:26
Vim plugins
ack.vim
bufexplorer
camelcasemotion
csv.vim
ctrlp.vim
emmet-vim
L9
nerdcommenter
nerdtree
syntastic
@taq
taq / refine.rb
Created December 26, 2013 12:15
Ruby 2.1 refinements
module TimeExtensions
refine Fixnum do
def min2sec; self * 60; end
end
end
class Minutes
using TimeExtensions
def self.to_sec(min)
# Use it like `export PS1="\h:\w[\$(ahead_behind)]$"`
function ahead_behind {
curr_branch=$(git rev-parse --abbrev-ref HEAD);
curr_remote=$(git config branch.$curr_branch.remote);
curr_merge_branch=$(git config branch.$curr_branch.merge | cut -d / -f 3);
git rev-list --left-right --count $curr_branch...$curr_remote/$curr_merge_branch | tr -s '\t' '|';
}
@taq
taq / leaky.rb
Last active December 21, 2015 03:19
Leaky procs
class Printer
@messages = []
def self.print
puts yield
end
def self.lazy_print(val=nil,&block)
@messages << val || block
end
@taq
taq / gist:5863818
Created June 26, 2013 00:46
Using Ruby 2.0 TracePoint to simulate an abstract interface
module AbstractInterface
class NotImplementedError < StandardError
def initialize(*methods)
super "You must implement the following methods: #{methods.join(', ')}"
end
end
def AbstractInterface.check_methods(klass,other,methods)
return if other.class==Module
TracePoint.new(:end) do |tp|
@taq
taq / gist:5849586
Last active December 18, 2015 21:48
Is Microsoft abandoning its mobile operating systems?
by Steven J. Vaughan-Nichols, zdnet.com
June 23rd 2013
Summary: In recent weeks Microsoft has been doing some odd things with mobile operating systems, Windows RT, and Windows Phone 8. I think Microsoft is moving towards dropping its mobile OSs in favor of supporting Microsoft applications on other platforms and eventually replacing them with Windows 8.1 on their own devices.
This is not your dad's Microsoft. Microsoft has been refocusing on Web services and devices instead of Windows and software products. One of those changes seems to be that if Microsoft's mobile operating systems can't cut the mustard, Microsoft isn't afraid to cut them off at the knees.
What am I talking about? Let's look at some of Microsoft's mobile news in the last few weeks.
First, some background. Goodness knows Windows 8 has been a market failure, but it's a rip-roaring success compared to Windows RT and Windows Phone 8 (WP8).
@taq
taq / gist:5793430
Created June 16, 2013 20:59
World worst hacker
This is a bunch of stuff relating to the localhost ip taken off bash.org. Apologies to all the non-technically minded people...
#60852
<Numi> hey, can you guys just check a site out and tell me if it's up?
<Haddock> depends, what is it?
<Numi> just my apache server, it works for me but seems to be down for anyone else
<Haddock> alright, what's the address?
<Numi> http://127.0.0.1
<Haddock> ......
<Haddock> ...Yeah, it's up.
@taq
taq / gist:5699377
Created June 3, 2013 16:28
Stupid PHP static variables behaviour
<?php
class A {
public static $name = null;
}
A::$name = "a";
class B extends A {
}
B::$name = "b";