Skip to content

Instantly share code, notes, and snippets.

View alejandrozepeda's full-sized avatar
🤠

Alejandro Zepeda alejandrozepeda

🤠
  • Mexico City
  • 00:46 (UTC -06:00)
View GitHub Profile
@jxson
jxson / README.md
Created February 10, 2012 00:18
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@benjamincharity
benjamincharity / smooscroll.js
Created May 9, 2012 17:56 — forked from cange/smooscroll.js
Simple smooth scrolling solution
// <a rel="smoothscroll" href="#foo">got to foo</a>
// <div id="foo">Foo content</div>
$(function () {
$('a[rel=smoothscroll]').click(function( event ) {
var location = window.location,
hash = $(this).attr('href')
;
$('html, body')
.stop()
.animate({scrollTop: $(hash).offset().top}, 800, function () {
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@thefella
thefella / gist:3513221
Created August 29, 2012 14:16
Detect if browser request is a prefetch or prerender using PHP
if ( (isset($_SERVER["HTTP_X_PURPOSE"]) and (strtolower($_SERVER["HTTP_X_PURPOSE"]) == "preview")) or
(isset($_SERVER["HTTP_X_MOZ"]) and (strtolower($_SERVER["HTTP_X_MOZ"]) == "prefetch")) ) {
// Request is a prerender or prefetch
} else {
// Request is 'normal'
}
@codeinthehole
codeinthehole / run.py
Created November 21, 2012 13:46
Sample Celery chain usage for processing pipeline
from celery import chain
from django.core.management.base import BaseCommand
from . import tasks
class Command(BaseCommand):
def handle(self, *args, **kwargs):
@tototoshi
tototoshi / rownum.sql
Created December 26, 2012 01:14
Grouped LIMIT in PostgreSQL: show the first N rows for each group
-- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group
-- http://www.postgresql.jp/document/9.2/html/tutorial-window.html
CREATE TABLE empsalary (
depname varchar(10) not null
, empno integer not null
, salary integer not null
);
INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200);
@jonathonbyrdziak
jonathonbyrdziak / .htaccess
Last active November 29, 2020 03:04
htaccess mod_expires / mod_cache / mod_deflate / mod_headers
# ------------------------------------------------------------------------------
#
# Curtousy of the Magento Support Center
# http://magentosupport.help/what-are-expires-headers-and-how-do-i-implement-them/
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# | Mod Caching via Apache |
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@todgru
todgru / aws-ec2-redis-cli.md
Created June 12, 2014 23:01
AWS redis-cli on EC2
@vishaltelangre
vishaltelangre / nginx_assets.md
Last active October 3, 2023 19:30
Serving Static Assets via Nginx

Concept

  • People talk about two servers: a web server (e.g. Nginx, Apache, etc.) and a app server (e.g. Language specific servers like Unicorn, Node.js, Tomcat, Http-Kit, etc.). There are exceptions where app servers not required at all (as web server itself provides preprocessors for handling), but let's not talk about now.
  • Web servers are really fast and supports lot of standard and commonly used MIME-type requests. Concept of serving a file is -- forming and sending a response of bytes of data and labeling it with requested MIME-type by a client (e.g. web browser).
  • Every response format (in layman's language, a file) is recognized by it's MIME-type, for e.g. a PNG image file has "image/png" MIME-type. JavaScript file has "text/javascript". HTML responses (or files) has "text/html". Plain text files have "text/plain".
  • Modern Browsers supports a lot of standard MIME-types. Images, videos, text files (XML, HTML, SVG, JS), and they better know how to visualize it. Browser also knows unrec