Skip to content

Instantly share code, notes, and snippets.

@HaloZero
HaloZero / gist:994336
Created May 26, 2011 23:21
interview
function getValues() {
var x = new Array();
for(var i=0; i < 10; i++) {
x[i] = function() { return i; }
}
return x;
};
var values = getValues();
for(var j=0; j < values.length; j++) {
@HaloZero
HaloZero / gist:1111213
Created July 28, 2011 08:34
Sublime 2 Preferences
{
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"draw_white_space": "all"
}
[@{@"1" : @"1", @"2" : @"3", @"3" : @"4", @"4" : @"5", @"5" : @"5"} enumerateKeysAndObjectsWithOptions:NSEnumerationReverse usingBlock:^(id key, id obj, BOOL *stop) {
NSLog(@"key is %@", key);
if ([key isEqualToString:@"4"]) {
stop = YES;
}
}];
def flatten(arr):
new_array = []
for element in arr:
if isinstance(element, list):
new_array.extend(flatten(element))
else:
new_array.append(element)
return new_array
{"text": "So today was a pretty normal day. I gotta keep more productive when I code becasue its hard to just spend hte entire day code reviewing and spending the time coding stuff up. I truly didn't get much done today with the lists feature except for a very bare bone basics of it, and even then Alan seems to have generated some other way of doing it.\n\nI left early from work, not sure what to do about that. I really gotta stop drinking my sodas and drinks and just stick with carrots and water from now on! Resist Rohan Resist!\n\nGame night was ok, glad when the annoying people left who were just really bothersome the entire time (the annoying blonde girl and such). I think I did ok, my usual awkward self when I tell stories I'm just not good at them. I need to be able to tell a story in words and in person with full confidence and without stopping in anyway. Gotta think of the better way to do it.\n\nOverall though it seems that I am not ANNOYING to the point where people don't like hanging out with me an
{"text":"Can you write a docstring for this Elixir function name? Elixir.Mix.compilers() <response> Returns the default compilers used by Mix.\n\nIt can be used in your `mix.exs` to prepend or\nappend new compilers to Mix:\n\n def project do\n [compilers: Mix.compilers() ++ [:foo, :bar]]\n end"}
{"text":"Can you write a docstring for this Elixir function name? Elixir.Mix.debug(debug) <response> Sets Mix debug mode."}
{"text":"Can you write a docstring for this Elixir function name? Elixir.Mix.debug?() <response> Returns `true` if Mix is in debug mode, `false` otherwise."}
{"text":"Can you write a docstring for this Elixir function name? Elixir.Mix.env() <response> Returns the current Mix environment.\n\nThis function should not be used at runtime in application code (as opposed\nto infrastructure and build code like Mix tasks). Mix is a build tool and may\nnot be available after the code is compiled (for example in a release).\n\nTo differentiate the program behavior depending on the environment, i