Skip to content

Instantly share code, notes, and snippets.

Sublime Text 2 – Useful Shortcuts (Windows)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command prompt
Ctrl+` python console
Ctrl+N new file

Editing

@jfsurban
jfsurban / why_style
Created September 7, 2012 04:02
why programming style
// http://www.smashingmagazine.com/2010/05/15/why-a-tale-of-a-post-modern-genius/
I do not write tests for my code. I do not write very many comments. I
change styles very frequently. And most of all, I shun the predominant
styles of coding, because that would go against the very essence of
experimentation. In short: all I do is muck around.
So, my way of measuring a great programmer is different from some
prevailing thought on the subject. I would like to hear what Matz
would say about this. You should ask him, seriously.
@jfsurban
jfsurban / why
Created September 7, 2012 04:00
why the lucky stiff re:Invitation for an Interview for Brazilian Blog
// http://www.akitaonrails.com/2012/09/03/why-documentary-at-rubyconf-2012-denver
Date: Thu, 19 Apr 2007 17:38:59 -0500
From: why the lucky stiff <[email protected]>
To: [email protected]
Subject: SPAM: Re: Invitation for an Interview for Brazilian Blog
On Wed, Apr 18, 2007 at 10:28:25AM -0300, Fabio Akita wrote:
> First of all let me introduce myself, my name is Fabio Akita, I've written
> the first brazilian Rails book called "Repensando a Web com Rails". I have a
@jfsurban
jfsurban / fp-vs-oop
Created September 3, 2012 03:31
Functional Programming vs OOP - http://news.ycombinator.com/item?id=4154940
The original vision behind OOP wasn't at odds with functional programming. In fact, it looks more like modern FP than modern OOP, with its FactoryFactories and POJOs and cargo cult bullshit that are more an artifact of a failed attempt to commoditize programming talent (one which hijacked OOP) than anything else.
Pure functional programming is great. Alan Kay would agree. However, the world is stateful. The original inspiration for OOP was the cell, which encapsulates complex physical machinery (state and behavior) behind a simpler chemical or electrical interface. The idea wasn't that complexity is a good thing (it's not) but that, when it becomes inevitable, it needs to be sequestered so that it's only visible to the few who need to fuss with the object's internals, not to the many who need to interact with it at an API level only.
An "object" is a complex entity whose interface is designed for simplicity. An example of this would be a SQL database. Query optimization is complex, but the interface is much
@jfsurban
jfsurban / gist:3185846
Created July 27, 2012 02:24 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@jfsurban
jfsurban / gist:3180662
Created July 26, 2012 07:02
Prevent ReflectionTypeLoadException when calling Assembly.GetTypes()
// http://stackoverflow.com/questions/7889228/how-to-prevent-reflectiontypeloadexception-when-calling-assembly-gettypes
Type[] types;
try
{
types = asm.GetTypes();
}
catch (ReflectionTypeLoadException e)
{
types = e.Types;
@jfsurban
jfsurban / bug-report
Created July 23, 2012 09:18
bug report
Please remember to always state
what you wanted to achieve;
what you did (the version of git and the command sequence to reproduce the behavior);
what you saw happen (X above);
what you expected to see (Y above); and
how the last two are different.
@jfsurban
jfsurban / gist:2716067
Created May 17, 2012 03:40
get last of month & get month name
public int getLastDayOfMonth() {
Calendar c = asCalendar();
// move to next month and decrement from the 1st day
c.add(Calendar.MONTH, 1);
c.set(Calendar.MONTH, 1);
c.roll(Calendar.MONTH, 1);
return c.get(Calendar.DAY_OF_MONTH);
}
public String getMonthName() {
Name Hex Decimal
E_UNEXPECTED 0x8000FFFF -2147418113
E_NOTIMPL 0x80004001 -2147467263
E_OUTOFMEMORY 0x8007000E -2147024882
E_INVALIDARG 0x80070057 -2147024809
E_NOINTERFACE 0x80004002 -2147467262
E_POINTER 0x80004003 -2147467261
E_HANDLE 0x80070006 -2147024890
E_ABORT 0x80004004 -2147467260
E_FAIL 0x80004005 -2147467259
@jfsurban
jfsurban / gist:2700204
Created May 15, 2012 08:59
subclass of ImageView which nulls the drawable references and calls gc when the imageview is detached from the window - http://bit.ly/L5OWwu
public class SingleShotImageView extends ImageView {
public SingleShotImageView(Context context) {
super(context);
}
public SingleShotImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}