Skip to content

Instantly share code, notes, and snippets.

View johnbender's full-sized avatar

John Bender johnbender

View GitHub Profile
//...
//create an array of all unique userids in the page
if(this.id != undefined)
{
var username = this.id;
//add this object (div by default) that met the query parameters
//to a list to be altered later
if( GitHubRepos.displayObjects[username] == undefined)
{
//...
//for each unique user
for(var i in GitHubRepos.displayObjects)
{
//format the github url for our given user and callback function
var github_url = format(GITHUB_JSON_URL, i, "GitHubRepos.DisplayRepos");
//insert a script into the DOM to add our JSON data via the github url
//once the script loads it will callback the DATA_DISPLAY_FUCNTION
<script src='http://github.com/api/v1/json/johnbender&callback=GitHubRepos.DisplayRepos'
type='text/javascript' >
</script>
GitHubRepos.DisplayRepos({"user": {"name": "John Bender", "repositories": [{"owner": "johnbender", "description": "Unit testing with Ruby for simple C bits, or small pieces of larger projects.", "name": "ryc", "watchers": 1, "private": false, "url": "http://github.com/johnbender/ryc", "forks": 0, "fork": false, "homepage": ""}, {"owner": "johnbender", "description": "GitHub Blog Badges for Everyone", "name": "github-badges", "watchers": 1, "private": false, "url": "http://github.com/johnbender/github-badges", "forks": 0, "fork": true, "homepage": "http://drnicjavascript.rubyforge.org/github_badge/"}], "blog": "http://nickelcode.com", "login": "johnbender", "location": "New York, NY"}});
//add the repo data to the div using the template
this.DisplayRepos = function(data)
{
//if we got properly formed data
if(data.user != undefined)
{
var user = data.user;
//for all the div objects that correspond to that user
for(var j in GitHubRepos.displayObjects[user.login])
<div class="delicious-user-top-links" id="johndoe|erlang">
</div>
<div class="delicious-user-top-links" id="johndoe|erlang+mnesia">
</div>
<script type='text/javascript'>
//FIRST
//script added before the remote resource call to delicious
//added dynamically with the right id
DeliciousTop.DisplayjohndoeLinks = function(data){
DeliciousTop.DisplayLinks(data, 'johndoe|erlang');
}
</script>
<script type='text/javascript' src='http://feeds.delicious.com/v2/json/nousplacidus/erlang?callback=DeliciousUserTop.DisplayjohndoeLinks'>
mnesia:create_schema([somenode]),
mnesia:add_table_copy(Tab, somenode, Type)
in function list_to_atom/1
called as list_to_atom(["obj"])
in call from erl_scan:scan/6
in call from smerl:parse_func_string/1
in call from smerl:add_func/3
in call from grove_appmod:get_query/3