Skip to content

Instantly share code, notes, and snippets.

John Bender johnbender

View GitHub Profile
View load_map.js
var map;
function load_map(){
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_div_12"));
map.setCenter(new GLatLng(40.73897,-74.033918),14);
//.. other map code here ..
}
}
View _map.html.erb
<%= map.map.to_html :function => "load_map" %>
<%= map.map.div :width => 550, :height => 300 %>
View loadMapOnPage.js
load_map();
$("map_div").show("slow");
View PermissionObject.cs
//calls
Method1(webToPass);
Method2(listToPass);
//definition
private void Method1 (SPWeb web)
{
web.permissions = "full";
}
View some_controller.rb
class SomeController < ActionController::Base
before_filter :authenticate, :only => [:destroy]
def index
#index actions
end
def show
#index actions
end
View some_controller.cs
public class SomeController : IController
{
public override void Index()
{
//Index action
}
public override void Show()
{
View constants.js
GITHUB_JSON_URL = "http://github.com/api/v1/json/{0}?callback={1}";
DYNAMIC_SCRIPT_TEMPLATE = "<script src='{0}' type='text/javascript' ></script>";
GITHUB_PROJECTS_CLASS = ".github-projects";
REPO_TEMPLATE =
"<div class='github-repo'>"
+ "<a href='{0}' target='_blank'>"
+ "{1}<img class='github-repo-link-image'"
+ "src='http://erlanguid.com/icons/external.png'"
+ "</a>"
+"</div>";
View GitHubRepos.js
var GitHubRepos = new function(){
this.displayObjects = new Array();
//retrieve the repo information from github
this.GetRepos = function()
{
//...
}
View GetRepos.js
this.GetRepos = function()
{
//create an array of the github data, used to prevent mutiple hits
//to the server for the same user
var github_usernames = new Array();
//for all the github-projects divs
$(GITHUB_PROJECTS_CLASS).each(function(i) {
//create an array of all unique userids in the page
View samplediv.html
<div class="github-projects" id="johnbender" style="display: block;">
<div class="github-projects-title">GitHub Projects</div>
</div>
You can’t perform that action at this time.