Skip to content

Instantly share code, notes, and snippets.

require_relative './helper'
require 'rdiff'
require 'tempfile'
describe RDiff do
it "should produce signature file consistently" do
file = Tempfile.new 'test'
file.write "blah blah blah"
#include <stdio.h>
#include <stdlib.h>
#include <librsync.h>
int
main()
{
FILE *base, *sig;
base = fopen("oldfile", "rb");
sig = fopen("sigfile", "wb");
diff -crB librsync-0.9.7/delta.c librsync-0.9.7-new/delta.c
*** librsync-0.9.7/delta.c 2004-09-18 05:35:49.000000000 +0800
--- librsync-0.9.7-new/delta.c 2012-03-05 23:03:56.000000000 +0800
***************
*** 125,136 ****
static rs_result rs_delta_s_flush(rs_job_t *job);
static rs_result rs_delta_s_end(rs_job_t *job);
void rs_getinput(rs_job_t *job);
! inline int rs_findmatch(rs_job_t *job, rs_long_t *match_pos, size_t *match_len);
! inline rs_result rs_appendmatch(rs_job_t *job, rs_long_t match_pos, size_t match_len);
@pencilcheck
pencilcheck / gist:2024657
Created March 12, 2012 21:00
the error page
NoMethodError in Users#new
Showing /app/app/views/users/_sign_up_form.html.haml where line #11 raised:
undefined method `username' for #<User:0x00000006b31c98>
Extracted source (around line #11):
8: .clearfix
9: = f.label :username
10: .input= f.text_field :username
= form_for user do |f|
- if user.errors.any?
.error_messages
Form is invalid
%ul
- for message in user.errors.full_messages
%li= message
.clearfix
= f.label :username
.input= f.text_field :username
%h1
Sign Up
= render :partial => 'sign_up_form', :locals => { :user => @user }
class UsersController < ApplicationController
before_filter :authenticate_user!, :only => [:edit, :update]
respond_to :html, :json
def index
#@users = User.all
return if current_user.nil?
@users = current_user
respond_with @users
@pencilcheck
pencilcheck / code
Created March 12, 2012 22:16
heroku log
33 respond_to :json¬
34 def update¬
35 @resume = current_user.resumes.find params[:id]¬
36 ¬
37 key = params[:model]¬
38 hash_id = params[key]['hash_id']¬
39 params[key][:start_date] = Time.utc params[key][:start_date][:year], \¬
40 params[key][:start_date][:month] if params[key].has_key? :start_date¬
41 params[key][:end_date] = Time.utc params[key][:end_date][:year], \¬
42 params[key][:end_date][:month] if params[key].has_key? :end_date¬
$ ->
# clear all caches
localStorage.clear()
list = new List('#overview li.item')
$('#overview li.add a').live 'click', (e) -> e.preventDefault(); list.add $(this).closest('li.add')
$('#overview li.item a').live 'click', (e) -> e.preventDefault(); list.select $(this).closest('li.item')
# Save to server
@pencilcheck
pencilcheck / changesetmaster
Created March 19, 2012 19:21
multiple inheritance
from Queue import Queue
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler, FileSystemEventHandler
class CMQueue(Queue, FileSystemEventHandler):
def __init__(self):
Queue.__init__(self)
FileSystemEventHandler.__init__(self)