Skip to content

Instantly share code, notes, and snippets.

View gotjosh's full-sized avatar
🎯
Focusing

gotjosh gotjosh

🎯
Focusing
View GitHub Profile
@gotjosh
gotjosh / gist:3220028
Created July 31, 2012 20:05
How can I avoid to create the array on the first line?
@videos = []
@publisher.sources.each { |s| @videos << s.videos.paginate(:per_page => params[:limit] ||= 10, :page => params[:page] ||= 1)}
@gotjosh
gotjosh / app.js
Created September 5, 2012 19:22 — forked from carsonmcdonald/app.js
Use S3 CORS FileAPI uploader
function createCORSRequest(method, url)
{
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr)
{
xhr.open(method, url, true);
}
else if (typeof XDomainRequest != "undefined")
{
xhr = new XDomainRequest();
@gotjosh
gotjosh / uri.js
Created November 1, 2012 20:12 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
var totalPages = 50, buttons = 3;
var currentPage = lowerLimit = upperLimit = Math.min(50, totalPages);
for (var b = 1; b < buttons && b < totalPages;) {
if (lowerLimit > 1 ) { lowerLimit--; b++; }
if (b < buttons && upperLimit < totalPages) { upperLimit++; b++; }
}
@gotjosh
gotjosh / gist:5462561
Last active December 16, 2015 16:19
Node controller.
index: function (req,res) {
api_url = api_base_url + '/sandwiches';
request.get(api_url, function(error, response, body){
if (!error && response.statusCode == 200) {
var sandwiches = body;
console.log(sandwiches);
res.view(sandwiches);
- si el post original dice "mejor" skip it.
- si dice offtopic you should read it.
- si dije java y .net en la misma oracion skip it.
- Si melvyn arranco el post skip it.
- If it has more than 50 replies skip it.
- if marmolejos answered first skip it.
- if Orly quotes the rules skip it.
- if it contains php next, probably not worth it.
- si dice morrison, dodo o software libre skip it.
http://zero-to-hero-ruby-intec.s3.amazonaws.com/demo-api.zip
@gotjosh
gotjosh / gist:8105782
Last active April 8, 2017 04:59
Pixel Perfect Tree's - Full Stack Developer

Pixel Perfect Tree - Full Stack Developer.

Hi there!

We’ve cleared out our desks to make space for a new member at Pixel Perfect Tree. We're a company that's 100% self bootstrap, we had an amazing year and continue to grow on a steady pace.

Our quest searching for a passionate and savvy full-stack developer has just begun.

The lucky developer will have the responsibility of defending our company’s honour fighting imaginary dragons and ogres along our skilled knights from the Order of the Pixel in our Santo Domingo office (however, if you are a wizard and prefer to fight from afar, remote work is a possibility for the right candidate). You'll be expected to not only to write code but also provide your insight on projects and technologies used.

module ParamsValidator
def validator array_of_values = [], default _value, param
array_of_values.include? param ? param : default_value
end
end
class ParamsValidator

Pixel Perfect Tree - Web Designer

Hi there!

We are Pixel Perfect Tree. We're a company that's 100% self bootstrap, we're having an amazing year and continue to grow on a steady pace.

We're currently looking for a keen-eye individual with a strong understanding of how visuals translate to web and the technical ability to bring it to life, in other words You'll be bringing the Pixel Perfect to our Tree, if this sounds like you, keep reading.

But what exactly do you mean by Web Designer? That's so confusing!