Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_PATH = File.expand_path('../..', __FILE__)
load File.expand_path('../../test/dummy/script/rails', __FILE__)
$ ab -c 1 -n 1000 http://127.0.0.1:3000/home
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
CXX Source/WebKit/gtk/webkit/libwebkitgtk_1_0_la-webkitversion.lo
CXX Source/WebKit/gtk/webkit/libwebkitgtk_1_0_la-webkitwebsettings.lo
CXX Source/WebKit/gtk/webkit/libwebkitgtk_1_0_la-webkitwebview.lo
CXX DerivedSources/webkit/libwebkitgtk_1_0_la-webkitenumtypes.lo
CXX Source/WebCore/inspector/libWebCore_la-InjectedScriptManager.lo
../../Source/WebCore/inspector/InjectedScriptManager.cpp: In member function ‘WTF::String WebCore::InjectedScriptManager::injectedScriptSource()’:
../../Source/WebCore/inspector/InjectedScriptManager.cpp:106: error: reinterpret_cast from type ‘const unsigned char*’ to type ‘char*’ casts away constness
make[1]: *** [Source/WebCore/inspector/libWebCore_la-InjectedScriptManager.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
#include <webkit/webkit.h>
#include <unistd.h>
static void
document_load_finished (WebKitWebView* web_view,
WebKitWebFrame* arg1,
gpointer user_data)
{
printf("Loaded, title: %s\n", webkit_web_view_get_title( (WebKitWebView *) web_view) );
}
test("fetching records", function() {
stop(5000);
var records = store.find(Todo);
records.addObserver('status', function() {
var titles = records.map(function(item) { return item.get('title'); }).sort();
equals(titles[0], "Bar");
equals(titles[1], "Foo");
start();
});
Todos.projectsCollectionView = SC.TemplateCollectionView.extend({
itemView: SC.TemplateView.extend({
isSelected: function() {
var selected = this.get('selected'),
content = this.get('content');
return selected && content && selected.get("storeKey") === content.get("storeKey");
}.property("selected").cacheable(),
mouseUp: function() {
@drogus
drogus / gist:978579
Created May 18, 2011 13:40
SproutCore FormView
{{#view SC.FormView target="Todos.userSessionController" action="signIn"}}
<!-- name="name" will be used to bind text fied to proper target,
insertNewLine will automatically call action -->
{{view Todos.TextField placeholder="Email" name="email"}}
{{view Todos.TextField placeholder="Password" type="password" name="password"}}
{{#view SC.Submit text="Sign in"}}
{{/view}}
@drogus
drogus / Kirkfile
Created October 17, 2011 18:27
request streaming
log :level => :all
rack "config.ru" do
listen 3030
# Set the file that controls the redeploys. This is relative to
# the applications root (the directory that the rackup file lives
# in). Touch this file to redepoy the application.
watch "config.ru"
end
@drogus
drogus / persistent_connections.rb
Created October 17, 2011 18:32
persistent connections example
# This example fetches accounts of my 10 followers using Github's API
# One version uses Connection: keep-alive, the other one uses Connection: close
require 'net/https'
require 'uri'
require 'json'
require 'benchmark'
def request(uri, persistent = true)
req = Net::HTTP::Get.new uri
CREATE OR REPLACE FUNCTION array_array_agg_sfunc(state integer[][], p integer[]) RETURNS integer[][] AS $$
BEGIN
IF p IS NULL THEN
RETURN state;
END IF;
IF array_dims(state) IS NULL THEN
RETURN ARRAY[p];
END IF;
RETURN array_cat(state, p);
END;