Skip to content

Instantly share code, notes, and snippets.

View onurozkan's full-sized avatar

Onur Özkan onurozkan

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

@hugoware
hugoware / mappath.node.js
Created December 24, 2011 15:55
Node.JS MapPath function
module.exports = {
//resolves the root of the site
map_path: function(path) {
return path.replace(/^~/, global.process.env.PWD);
},
//resolves the path and performs a require
require: function(path) {
@jotapepinheiro
jotapepinheiro / slugUrl.sql
Created April 10, 2012 04:35
SLUG URL POSTGRE FUNCTION
CREATE OR REPLACE FUNCTION public.url_slug (
s_texto text
)
RETURNS varchar AS
$body$
DECLARE
total integer;
BEGIN
s_texto := replace(s_texto , 'U$', 'dolares');
s_texto := replace(s_texto , 'R$', 'reais');
@pies
pies / ExcelFormulas.js
Created November 29, 2012 04:55
Few Excel formulas - PMT, PPMT, XIRR - expressed in Javascript
/* Based on
* - EGM Mathematical Finance class by Enrique Garcia M. <egarcia@egm.co>
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1)
*/
var ExcelFormulas = {
PVIF: function(rate, nper) {
return Math.pow(1 + rate, nper);
},
@n1k0
n1k0 / 404checker.js
Created January 11, 2013 10:55
A CasperJS script to check for 404 & 500 internal links on a given website
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
@TCotton
TCotton / media-query-testing.css
Last active December 15, 2015 07:58
Media query testing on different devices
@media only screen and (max-width:1280px) and (-webkit-min-device-pixel-ratio: 1.0),
only screen and (max-width:1280px) and (min-resolution: 120dpi) {
/* ipad 3 portrait / landscape
ipad 2 portrait / landscape
ipad 1 portrait / landscape
amazon kindle fir hd portrait
nexus 7 landscape
Samsung Galaxy Note 10.1 landscape
Samsung Galaxy Tab 2 10.1 landscape
LG Nexus 4 portrait
@pete-otaqui
pete-otaqui / happytime-amd.js
Last active February 10, 2018 18:00
A better setTimeout, setInterval and requestAnimationFrame, wrapped as an AMD module and fine for many JSHint setups.
/*
See http://paulirish.com/2011/requestanimationframe-for-smart-animating/
and http://blog.joelambert.co.uk/2011/06/01/a-better-settimeoutsetinterval/
*/
define([
],
function () {
'use strict';
@SerhiiKozachenko
SerhiiKozachenko / repository.js
Created August 6, 2013 21:54
Mongoose odm and repository pattern.
var mongoose = require('mongoose');
var repository = function (modelName) {
var self = this;
self.Model = require('../models/' + modelName);
self.FindById = function (id, cb) {
self.FindOne({
@thebucknerlife
thebucknerlife / authentication_with_bcrypt_in_rails_4.md
Last active January 17, 2024 23:54
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps