Skip to content

Instantly share code, notes, and snippets.

@yoshiori
yoshiori / coderwall.html
Created July 12, 2012 07:54
octopress coderwall badges
{% if site.coderwall_user %}
<section class="well">
<ul class="nav">
<li class="nav-header">Coderwall Badges</li>
</ul>
<div id="coderwall_badges"></div>
<a href="http://coderwall.com/{{site.coderwall_user}}">@{{site.coderwall_user}}</a> on coderwall
<script type="text/javascript">
$(document).ready(function(){
$.getJSON("http://coderwall.com/{{site.coderwall_user}}.json?callback=?", function(data){
@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
@ls-lukebowerman
ls-lukebowerman / sitemap.xml.erb
Created August 7, 2012 17:59
Sitemap (sitemaps.org) generator for Middleman
<% pages = sitemap.resources.find_all{|p| p.source_file.match(/\.html/) } %>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<% pages.each do |p| %>
<url>
<loc>http://youdomain.com/<%=p.destination_path.gsub('/index.html','')%></loc>
<priority>0.7</priority>
</url>
<% end %>
</urlset>
@ilake
ilake / gist:3656567
Created September 6, 2012 14:01
Add X-CSRF-Token header for ajax call to pass csrf verfication
// reference : http://stackoverflow.com/questions/7203304/warning-cant-verify-csrf-token-authenticity-rails
// : http://stackoverflow.com/questions/8511695/rails-render-json-session-lost
$.ajax({ url: 'YOUR URL HERE',
type: 'POST',
beforeSend: function(xhr) {
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))
},
data: 'someData=' + someData,
success: function(response) {
@ryanflorence
ryanflorence / Base.coffee
Created September 9, 2012 01:06
Base CoffeeScript Class, surprisingly useful.
################################################################################
# script: Base.coffee
# author: Ryan Florence <[email protected]>
# license: MIT-Style License
#
# A surprisingly useful base class for CoffeeScript. Inspired by my old
# friend, MooTools Class. Provides default options, mixins, and custom events.
class Base
defaults: {}
@rc1021
rc1021 / gist:3736213
Created September 17, 2012 08:41
Issues with RMagick on RubyStack 3.2.1-1
// will be error.
$ sudo gem install rmagick -v '2.13.1'
// If you want to compile or install your own RMagick, you should install the following libraries in your system:
$ sudo apt-get install libbz2-dev libxt-dev libxext-dev
// Then remove the following file if exists:
$ sudo rm /opt/bitnami/common/lib/libbz2.a
// And finally you can install RMagick
@maylogger
maylogger / gist:3759884
Created September 21, 2012 05:31
貓假圖
module ViewHelpers
def placekitten(size, options={})
domain = options[:domain] || "http://placekitten.com"
src = "#{domain}/#{size}?image=#{rand(16)+1}"
g = options[:g]
if options[:g]
src = "#{domain}/g/#{size}?image=#{rand(16)+1}"
end
@domenic
domenic / promises.md
Last active November 4, 2025 20:27
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@nickawalsh
nickawalsh / icons.sass
Last active October 7, 2021 09:38
Auto Hi-res Sprites
@import compass
$icons: sprite-map("icons/*.png")
$icons-hd: sprite-map("icons-hd/*.png")
i
background: $icons
display: inline-block
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi)
background: $icons-hd
@yorkxin
yorkxin / README.md
Created December 14, 2012 07:45
Notes on Paul Irish's "Things I learned from the jQuery source" casts.

Notes on Paul Irish's "Things I learned from the jQuery source" casts

I watched these videos on 2012/12/14. Today's jQuery version is 1.8.3. So there might be some differences from the original video. I've briefly noted some of the differences between what described in the video and the current stable release. Most code he desribed can be found easily in speed/jquery-basic.js (1.4.2).

Episode 1

2010-06-14 (jQuery 1.4.1)