This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a simple template for bug reproductions. It contains three models `Person`, `Animal` and `Movie`. | |
* They create a simple IMDB-style database. Try to add minimal modifications to this file to reproduce | |
* your bug. | |
* | |
* install: | |
* npm install objection knex sqlite3 chai | |
* | |
* run: | |
* node reproduction-template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm trying to figure out how to fetch comments for objects and optimize memory usage and lookup speed. One video has multiple comments and comments will always be fetched using VideoID or VideoID + CommentID. | |
Our setup: One master in Amazon and a slave on each Web server. The web-servers will deliver this data, so the web servers will fetch this locally. | |
Some stats: Every video has in general 10-20 comments. | |
Idea 1: Store comments in a hash with VideoID as key, Comment ID as field and comment-data as value. Then fetching the whole hash and sorting it based on a Sorted set with VideoID as key and CommentIDs as values. | |
Pros: Only two lookups to fetch all comments (One for Sorted list and One for the hash). | |
Cons: VideoID will always be needed to fetch a comment (Okay in our application). We are not utilizing the memory savings of using a hash too keep down the memory size used by redis. | |
Redis storage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// showdown.js -- A javascript port of Markdown. | |
// | |
// Copyright (c) 2007 John Fraser. | |
// | |
// Original Markdown Copyright (c) 2004-2005 John Gruber | |
// <http://daringfireball.net/projects/markdown/> | |
// | |
// The full source distribution is at: | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Story line för reklam för FEMME NATURAL BOOST: | |
Klockan är runt 10 på kvällen. Gudrun Schyman kommer hem från en tuff dag på jobbet och är helt slut. | |
Man ser rynkorna i hennes ansikte från hennes tuffa arbetsdag samtidigt som hon trött öppnar dörren | |
till sitt gula nymålade radhus. Hon tar några tunga steg fram till kylen och öppnar en FEMME NATURAL | |
BOOST. Hon öppnar burken och tar sig en första sipp. Hennes ögon skiner upp och hon blir genast mycket | |
piggare och häller i sig resten av innehållet ur burken. Hon sliter åt sig två stycken till och häller | |
i sig den ena kvickt samtidigt som hon springer ut genom ytterdörren och hoppar ner för trappstegen | |
utanför. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=============================================== | |
============== R E Q U E S T ===================== | |
=============================================== | |
POST /xmlrpc.php HTTP/1.1 | |
Accept: */* | |
Connection: keep-alive | |
User-Agent: XMLRPC::Client (Ruby 1.8.7) | |
Content-Type: text/xml; charset=utf-8 | |
Host: myshowroom.se |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=============================================== | |
============== R E Q U E S T ===================== | |
=============================================== | |
POST /xmlrpc.php HTTP/1.1 | |
Accept: */* | |
Connection: keep-alive | |
User-Agent: XMLRPC::Client (Ruby 1.8.7) | |
Content-Type: text/xml; charset=utf-8 | |
Host: myshowroom.se |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$post=new Post; | |
$post->title='sample post'; | |
$post->content='post body content'; | |
$post->save(); | |
VS | |
Post.new(:title => 'sample post', :content => 'post body content').save | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (! ('console' in window) || !('firebug' in console)) { | |
var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml', 'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd']; | |
window.console = {}; | |
for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
padrino generate project fisk | |
## app/models/blogger.rb | |
class Blogger < User | |
include BloggerUtils | |
end | |
## app/models/user.rb | |
class User | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## SERVER (config.ru) | |
## Start with: thin start -V -R config.ru | |
app = proc do |env| | |
[ | |
200, | |
{ | |
'Content-Type' => 'text/html', | |
'Content-Length' => '2' |
NewerOlder