Skip to content

Instantly share code, notes, and snippets.

$ git pull && make test
Already up-to-date.
==35847== WARNING: Support on MacOS 10.8/10.9 is experimental and mostly broken.
==35847== WARNING: Expect incorrect results, assertions and crashes.
==35847== WARNING: In particular, Memcheck on 32-bit programs will fail to
==35847== WARNING: detect any errors associated with heap-allocated data.
==35847==
FILE "buffer.test":
SET " buffer management":
TEST " initialization": OK
# app/models/review.rb
class Review < ActiveRecord::Base
# This class has a `body` and `body_rendered` attribute (for rendered markdown).
# The `Markdown` concern will automagically render markdown to the right attributes.
include Markdown
end
@gabrielecirulli
gabrielecirulli / paperclip_stub.rb
Last active December 21, 2015 17:29
Use this code to stub out the ImageMagick functions present in Paperclip to make tests faster. If you're using RSpec, a good way to use this is including it in a file in spec/support.
module Paperclip
module Helpers
def run(cmd, arguments = "", interpolation_values = {}, local_options = {})
case cmd
when "convert"
return true
when "identify"
return "100x100"
else
super
/**
* Called when a message is passed from the extension.
*
* Use this script to provide functionality that needs a background script to work.
*/
(function() {
var modules = {
mark_as_read: {
toggle: function (params) {
#!/usr/bin/env ruby
# "quick and dirty" warpzone link creator
# Create a directory to use as a warpzone somewhere handy.
# Put this script inside it and it will help you make links inside it
# Specify an absolute path to the project as the first argument and an optional link name as the second
if ARGV[0]
project_path = ARGV[0]
if not Dir.exists? project_path
#!/usr/bin/env ruby
# fp_images.php scrapper
require 'nokogiri'
require 'open-uri'
require 'net/http'
require 'uri'
require 'fileutils'
require 'colorize'
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Trie
{
class TrieNode
{
private TrieNode[] children;
@gabrielecirulli
gabrielecirulli / randomgit.py
Created February 22, 2012 15:46
Random Git Repo Generator
#!/usr/bin/env python
## TODO: less mixed file types DONE
## TODO: less ramifications (truncate after a certain depth) DONE
## TODO: file/dir modification and removal DONE
from __future__ import print_function
import os, random, string, subprocess, time, shutil, md5
extensions = ['css', 'js', 'html', 'cpp', 'txt', 'png', 'c']
def make_empty_file(path, name):