Skip to content

Instantly share code, notes, and snippets.

View facundofarias's full-sized avatar
🏠
Working from home

Facundo Farias facundofarias

🏠
Working from home
View GitHub Profile
@mislav
mislav / pagination.md
Created October 12, 2010 17:20
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@manzke
manzke / TailorWebSocketServlet.java
Created June 12, 2011 21:04
Jetty 7+8 Web Socket Example
package de.devsurf.html.tail;
import java.io.IOException;
import java.util.Date;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@helloluis
helloluis / Slim HTML5 Boilerplate Conditional Comments
Created August 31, 2011 08:52
How to get HTML5 Boilerplate-style Conditional Comments Working in Slim
doctype html
/[if lt IE 7]
| <html class="ie6">
/[if IE 7]
| <html class="ie7">
/[if IE 8]
| <html class="ie8">
/[if IE 9]
| <html class="ie9">
| <!--[if (gte IE 9)|!(IE)]<!--> <html> <!--<![endif]-->
@mathiasbynens
mathiasbynens / jquery.loadasync.js
Created September 6, 2011 09:44
Use jQuery to load scripts asynchronously
// Load scripts asynchronously
jQuery.loadAsync = function(url, callback) {
// Don't use $.getScript since it disables caching
jQuery.ajax({
'url': url,
'dataType': 'script',
'cache': true,
'success': callback || jQuery.noop
});
};
@jcasimir
jcasimir / render_and_redirect.markdown
Created September 11, 2011 21:29
Render and Redirect in Rails 3

Render and Redirect

The normal controller/view flow is to display a view template corresponding to the current controller action, but sometimes we want to change that. We use render in a controller when we want to respond within the current request, and redirect_to when we want to spawn a new request.

Render

The render method is very overloaded in Rails. Most developers encounter it within the view template, using render :partial => 'form' or render @post.comments, but here we'll focus on usage within the controller.

:action

@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active June 9, 2024 23:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@rocketraman
rocketraman / equals-hash-tostring.java
Last active April 27, 2023 04:53
Example of Guava-based equals, hashCode, toString implementations
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
public class Address {
...
@Override
public boolean equals(Object obj) {
@jpoehls
jpoehls / smtp-test.ps1
Created December 14, 2011 17:26
SMTP Test Script (in PowerShell)
$smtp = New-Object System.Net.Mail.SmtpClient
$smtp.Host = "127.0.0.1"
$smtp.Port = 587
$creds = New-Object System.Net.NetworkCredential
# $currentCreds = Get-Credential
$creds.Domain = ""
$creds.UserName = "my_user" # $currentCreds.UserName
$creds.Password = "my_pass" # $currentCreds.GetNetworkCredential()
@tkarpinski
tkarpinski / web.config
Created January 16, 2012 14:43
webconfig for http to https redirect
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
@shu0115
shu0115 / gist:2367193
Created April 12, 2012 13:24
Error installing pg gem in Mac OS X
$ bundle install
----------------------------------------------------------------------------------------------------
Installing pg (0.13.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/raisondetre0115/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no