Skip to content

Instantly share code, notes, and snippets.

View daviferreira's full-sized avatar

Davi Ferreira daviferreira

View GitHub Profile
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@fsouza
fsouza / main.go
Last active December 16, 2015 07:29
func main() {
index, err := search.NewIndex(os.Args[1:]...)
if err != nil {
log.Fatal(err)
}
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanLines)
fmt.Print("> ")
for scanner.Scan() {
articles, err := index.Search(scanner.Text())
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@ngauthier
ngauthier / README.md
Created July 5, 2012 20:10
Rdio "native" in linux

I like Rdio and linux. Rdio works great in a browser except for one thing: keyboard shortcuts!!!

When coding, I like to be able to play/pause my music quickly, meaning I don't want to switch windows. I figured out a way to do this:

Google Chrome --app

First, I made a file in my ~/bin called rdio that runs:

google-chrome --app=http://rdio.com
@brentvatne
brentvatne / quickerclip.rb
Created June 21, 2012 18:17 — forked from yeeguy/quickerclip.rb
Faster rspec tests with Paperclip
# inspired by https://gist.github.com/406460 and
# http://pivotallabs.com/users/rolson/blog/articles/1249-stubbing-out-paperclip-imagemagick-in-tests
# plus some additional monkeypatching to prevent "too many files open" err's
#
# place this file in <app root>/spec/support
#
RSpec.configure do |config|
$paperclip_stub_size = "800x800"
end
(function($){
function dragEnter(e) {
$(e.target).addClass("dragOver");
e.stopPropagation();
e.preventDefault();
return false;
};
function dragOver(e) {
e.originalEvent.dataTransfer.dropEffect = "copy";
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@olooney
olooney / cropped_thumbnail.my
Created January 12, 2012 16:31
A "better" thumbnail algorithm for Python Image Library PIL Image
'''
PIL's Image.thumbnail() returns an image that fits inside of a given size (preserving aspect ratios)
but the size of the actual image will vary and is certainly not guaranteed to be the requested size.
This is often inconvenient since the size of the returned thumbnail cannot be predicted. The django-thumbs
library solves this for square thumbnails by cropping the image to a square and then resizing it. However,
this only works for exact squares.
This function generalizes that approach to work for thumbnails of any aspect ratio. The returned thumbnail
is always exactly the requested size, and edges (left/right or top/bottom) are cropped off to adjust to
make sure the thumbnail will be the right size without distorting the image.
@MatthewEppelsheimer
MatthewEppelsheimer / breakpoints.css
Created January 8, 2012 06:17
Responsive Break Point Media Query Boilerplate
// Mobile First
@media screen and (min-width: 321px) { // iPhone landscape
}
@media screen and (min-width: 481px) { // iPad portrait
}