Skip to content

Instantly share code, notes, and snippets.

View dgs700's full-sized avatar

David Shapiro dgs700

  • Mountain View, CA
View GitHub Profile
require(['sm_lib/sm.config'], function() {
require(['sm_widget_mentorship_close', 'sm_widget_user_survey',
'views/avatar_slidetab', 'sm_default'],
function(widgetMentorship, userSurvey, AvatarSlideTab){
var avatarSlideTab = new AvatarSlideTab();
userSurvey.show();
widgetMentorship.mentorship_close(".btn_mentorship_close");
@dgs700
dgs700 / phMenuManager.js
Created April 16, 2012 02:33
Some OLD jQueryLESS Javascript that manipulates the DOM and manages events
//creates dynamic dropdown menus
//based on Danny Goodman's code appearing in "Javascript&Dhtml Cookbook" - O'Rielly
window.phMenuManager = (function(global){
return {
// event mgmt functions
addEvent: function (elem, evtType, func, capture) {
capture = (capture) ? capture : false;
if (elem.addEventListener) {
elem.addEventListener(evtType, func, capture);
@dgs700
dgs700 / index.html
Created April 13, 2012 01:42
My resume page code - html5, some css3
<!doctype html>
<html lang=en>
<head>
<meta charset="utf-8" />
<meta name="verify-v1" content="91yIG+EaOdwKuPX+R9ChHEWVXJ6wdQsq0gqD1c1sbaY="/>
<title>David Shapiro, Resume- Web Developer</title>
<style type="text/css">
body{font-family:Geneva, Arial, Helvetica, sans-serif;font-size:12px;font-weight:normal;color:#000000;text-align:center;margin:0;padding:0;line-height:1.5em;}
header, section, article{display:block;}
header{text-align:center;position:relative;z-index:1;}
@dgs700
dgs700 / Application.java
Created April 13, 2012 00:30
A slice from an old Java, Struts2, Hibernate, Spring application - the applications part is still in service at http://conservationcorpsnorthbay.org/f/eng/hyc_programs_apply
package org.ccnb.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
/**
* application table entity class
* @author david
*/
@dgs700
dgs700 / midpenbgc_landing.css
Created April 12, 2012 23:35
Landing page styles for www.midpenbgc.org.
@charset "utf-8";
body {
margin:0;
font-family:arial, verdana, helvetica, san-serif;
}
a {
text-decoration:none;
cursor:pointer;
}
h1,
@dgs700
dgs700 / appController.php
Created April 12, 2012 21:06
CakePHP base MV(C) base controller class
<?php
// cakePHP application wide controller settings
class AppController extends Controller {
var $components = array('Session', 'Cookie');
var $language = null;
var $languages = array();
var $file = null;
var $ext = '.php';
@dgs700
dgs700 / partnerLogos.js
Created April 12, 2012 20:57
singleton / module obj that builds the scrolling logos element at the bottom of www.midpenbgc.org
//dependent on jQuery and jquery.scrollable
var midPenBGC = (function ($) {
return{
appendPartners: function(o){
var params = o || {},
ir = params.image_root || this.image_root || "/c/images/logos/",
elem = params.elem || "#partners",
partners = params.partners || this.partners || [],
imgElem = '<img src="' + ir + 'partner.jpg"/>',
length = partners.length,
@dgs700
dgs700 / event_mgr.js
Created April 12, 2012 20:18
A singleton / module object and its use plus lots of jQuery from a non-profit client
/*
Example of a singleton object and its use for protected member access and
extensive use of jQuery. This code manages validation and ajax submits of form data,
and is used to display / hide panes in a wizard form plus build an extra data field
with all the form data for email notification. The code is used on a non-profit
website for it's annual golf and banquet fundraising events.
*/
var eventMgr = (function (global) {
var donationTotal = 0,
@dgs700
dgs700 / sm.upload.js
Created March 29, 2012 22:33
Production AJAX avatar image and file uploader in use at StudentMentor.org. Based on jQuery and jQuery.Fileupload.
define(['underscore', 'cookie', 'fileupload', 'widget', 'iframe'], function(){
return {
// call from page specific context w/ config obj that defines
// a script or div element containing page specific html (templateID), location to insert
// processed template (targetID) and an obj (vars) defining any variable placeholders
renderUploadContainer: function(config){
var vars = config.vars || {},
templateID = config.templateID || null,
targetID = config.targetID || null,
@dgs700
dgs700 / Paginator.js
Created March 29, 2012 22:22
Version .02 alpha of a Backbone.js based app for mentorship requests at StudentMentor.org. Some of the key features are: - dependancy management and loading via Require.js - nested / deep models via Backbone-relational.ja - complete separation of Javascri
// generic paginator view functions and bindings
// code here lifted from Adi Osmani's client example
define(['order!underscore', 'order!Backbone'], function PaginatorView(){
var PaginatorView = Backbone.View.extend({
config: {},
//this should be overridden
initialize: function(){