Skip to content

Instantly share code, notes, and snippets.

View freidamachoi's full-sized avatar

Bo freidamachoi

View GitHub Profile
@freidamachoi
freidamachoi / CustomOpportunityHome.page
Created February 1, 2013 14:24
VISUALFORCE: Paging List
<apex:page standardController="Opportunity" recordSetVar="opportunities" extensions="OpportunityHomeExtension" sidebar="false">
<apex:sectionHeader title="Opportunities" subtitle="Home" />
<apex:form id="f">
<apex:panelGrid id="bodyTable" columns="2" styleClass="outer" width="100%">
<apex:panelGroup >
<td id="sidebarCell" class="sidebarCell">
<div class="sidebar" id="sidebarDiv"><!-- OPPORTUNITY STAGE -->
<div class="sidebarModule">
@freidamachoi
freidamachoi / gist:5057619
Created February 28, 2013 15:38
GOOGLEMAPS: STREETVIEW
<html>
<head>
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Embedded StreetView</title>
<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
function initialize() {
var bryantPark = new google.maps.LatLng(37.869260, -122.254811);
var panoramaOptions = {
/*
Javascripters can create inline object literals with dynamic values:
var sue = {name: "Sue", adult: person.age >= 18};
Javascripters cannot create inline object literals with dynamic keys:
var family = {herman.role: herman, lily.role: lily} //impossible...
// family == {husband: herman, wife: lily};
var family = {}; //...unless we resort to longhand.
family[herman.role] = herman;
family[lily.role ] = lily;
_.mixin({
/* Like extend but get key/values object->key_names */
extend_from: function(object, source_object, key_names) {
return _(object).extend(_(source_object).slice(key_names));
},
/* Return a new object with the merged properties of all objects in arguments */
merge: function() {
var objects = arguments;
return _.reduce(_.rest(objects), function(obj, o) {
<!--
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@freidamachoi
freidamachoi / nsModular.js
Created August 1, 2013 19:44
Namespace + Modular Pattern
MyApplication.namespace("Util.Events").module = (function () {
// private area ...
return {
// public area ...
};
})();
@freidamachoi
freidamachoi / ngSortNumeric.js
Created August 15, 2013 05:16
AngularJs - sort numeric
$scope.mySortFunction = function(item) {
if(isNaN(item[$scope.sortExpression]))
return item[$scope.sortExpression];
return parseInt(item[$scope.sortExpression]);
}
@freidamachoi
freidamachoi / myNgService.js
Created August 27, 2013 15:48
ngForceService
'use strict';
ot.service('myService', function myService (localStorage, $rootScope, $q, vfr) {
var self = this;
self.add = function(item, premise) {
if(!self.premise || !self.premise.id) {
self.premise = {
id: premise.Premise__c,
description: premise.Premise__r.StreetAddress__c
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');