Skip to content

Instantly share code, notes, and snippets.

Gregorio Setti desmondhume

Block or report user

Report or block desmondhume

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View biggest_product.rb
require 'benchmark'
# Solution 1
def solution_1(list_of_inputs)
list_of_inputs
.sort { |x, y| x<=>y }
.first(3)
.reduce(&:*)
end
@desmondhume
desmondhume / map_to_query_string.ex
Created Aug 6, 2016
Convert elixir map to query string
View map_to_query_string.ex
defmodule URL do
def to_query(input, namespace) do
Enum.map(input, fn({key, value}) -> parse("#{namespace}[#{key}]",value)end)
|> Enum.join("&")
end
def to_query(input) do
Enum.map(input, fn({key, value}) -> parse(key,value) end)
|> Enum.join("&")
end
@desmondhume
desmondhume / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Ajax single page
<?php
function curl_download($Url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm");
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
View HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install libxml2
/usr/bin/make all-recursive
Making all in include
Making all in libxml
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `all-am'.
Making all in .
CC entities.lo
CC encoding.lo
CC SAX.lo
CC error.lo
@desmondhume
desmondhume / snippet.html
Created May 7, 2013
Pure css cross-browser arrow
View snippet.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<a href="">Scopri<span></span></a>
</body>
</html>
@desmondhume
desmondhume / gist:5510040
Last active Dec 16, 2015
Example of pure css fold on top of a box.
View gist:5510040
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tests</title>
<style>
.badge {
background: green;
width: 200px;
You can’t perform that action at this time.