Skip to content

Instantly share code, notes, and snippets.

View markcerqueira's full-sized avatar
📌
Join me! Pinterest is hiring!

Mark Cerqueira markcerqueira

📌
Join me! Pinterest is hiring!
View GitHub Profile
@ilkka
ilkka / archivepage.rb
Created November 19, 2010 19:37
Jekyll ArchivePage class
module Jekyll
class ArchivePage
include Convertible
attr_accessor :site, :pager, :name, :ext, :basename, :dir, :data, :content, :output
# Initialize new ArchivePage
# +site+ is the Site
# +month+ is the month
# +posts+ is the list of posts for the month
@ilkka
ilkka / archivegenerator.rb
Created November 20, 2010 15:44
Jekyll archive page generator plugin
module Jekyll
class ArchiveGenerator < Generator
safe true
def generate(site)
collate_by_month(site.posts).each do |month, posts|
page = ArchivePage.new(site, month, posts)
site.pages << page
end
end
@mikeygee
mikeygee / 01-before.html
Created May 7, 2012 07:45
truncate blog posts in jekyll
<!-- using the truncate filter -->
{% for post in site.posts limit:10 %}
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<span class="post-date">{{ post.date | date: "%B %d, %Y" }}</span>
{% if post.content.size > 2000 %}
{{ post.content | truncatewords: 300 }} <!-- bad! content gives you rendered html and you will truncate in the middle of a node -->
<a href="{{ post.url }}">read more</a>
{% else %}
{{ post.content }}
{% endif %}
@josephwecker
josephwecker / new_bashrc.sh
Created August 11, 2012 04:36
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
@arq5x
arq5x / unique-bash-history.sh
Created January 22, 2013 02:52
Unique BASH history
HISTCONTROL="erasedups"
export HISTCONTROL
@jkubicek
jkubicek / .git-completion.sh
Created March 13, 2013 20:30
Git tab completion script
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.
## Gerrit is dumb ##
####################
alias gerrit='ssh -p 29418 <wherever you run gerrit> gerrit'
# Usage #
# gerritIds <project>
# will list all change ids by you that are open for <project>
# useful to find what ids will will be abandoned by abandonALl
gerritIds() {
gerrit query --format=JSON --patch-sets -- status:open project:$1 | grep -v runTimeMilliseconds | grep -E "`git config user.email`" | grep -E -o '"number":"\d\d+"' | tr '"' ' ' | cut -d' ' -f4-