Skip to content

Instantly share code, notes, and snippets.

# THIS CODE IS VERY UGLY
# I AM NOT SORRY
# Copyright 2013 Kyle Varga
#
# 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
@noeticpenguin
noeticpenguin / rakefile.rb
Created June 10, 2013 15:12
Base Rakefile for RubyMotion projects incorporating the Salesforce Mobile SDK(iOS).
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require 'rubygems'
require 'bundler'
Bundler.require
require 'sugarcube-repl'
Motion::Project::App.setup do |app|
<apex:page controller="CustomerCommunityController" id="customercommunitycontroller" sidebar="false" showHeader="false" standardStylesheets="false" >
<head>
<title>Acme Customer Support</title>
<meta charset="utf-8" />
<apex:includeScript value="{!$Resource.jquery}"/>
</head>
<script type="text/javascript">
class Obj < ActiveRecord::Base
belongs_to :org
has_many :fields
has_many :record_type_infos
accepts_nested_attributes_for :fields, :record_type_infos
attr_accessible :name, :label, :keyPrefix, :custom, :labelPlural, :layoutable, :activateable, :searchable,
:deprecatedAndHidden, :createable, :updateable, :deletable, :customSetting, :feedEnabled,
:mergeable, :queryable, :replicateable, :retrieveable, :undeletable, :triggerable, :org_id, :urls
class Field < ActiveRecord::Base
belongs_to :obj
has_many :child_relationships
has_many :picklist_values
accepts_nested_attributes_for :child_relationships, :picklist_values
attr_accessible :length, :name, :type, :defaultValue, :label, :byteLength, :unique, :nameField,
:sortable, :filterable, :calculated, :scale, :precision, :nillable, :caseSensitive,
:inlineHelpText, :controllerName, :writeRequiresMasterRead, :externalId, :idLookup,
@noeticpenguin
noeticpenguin / index.xlsx.axlsx
Created July 30, 2013 14:31
style with sheet.
wb.styles do |s|
header = s.add_style :fg_color=> "FFFFFF",
:b => true,
:bg_color => "004586",
:sz => 12,
:border => { :style => :thin, :color => "00" },
:alignment => { :horizontal => :center,
:vertical => :center ,
:wrap_text => true}
end
function getLocaleDateString(){
var formats ={"ar-SA":"dd/mm/yy","bg-BG":"dd.m.yyyy","ca-ES":"dd/mm/yyyy","zh-TW":"yyyy/m/d","cs-CZ":"d.m.yyyy",
"da-DK":"dd-mm-yyyy","de-DE":"dd.mm.yyyy","el-GR":"d/m/yyyy","en-US":"m/d/yyyy","fi-FI":"d.m.yyyy","fr-FR":"dd/mm/yyyy",
"he-IL":"dd/mm/yyyy","hu-HU":"yyyy. mm. dd.","is-IS":"d.m.yyyy","it-IT":"dd/mm/yyyy","ja-JP":"yyyy/mm/dd",
"ko-KR":"yyyy-mm-dd","nl-NL":"d-m-yyyy","nb-NO":"dd.mm.yyyy","pl-PL":"yyyy-mm-dd","pt-BR":"d/m/yyyy",
"ro-RO":"dd.mm.yyyy","ru-RU":"dd.mm.yyyy","hr-HR":"d.m.yyyy","sk-SK":"d. m. yyyy","sq-AL":"yyyy-mm-dd",
"sv-SE":"yyyy-mm-dd","th-TH":"d/m/yyyy","tr-TR":"dd.mm.yyyy","ur-PK":"dd/mm/yyyy","id-ID":"dd/mm/yyyy",
"uk-UA":"dd.mm.yyyy","be-BY":"dd.mm.yyyy","sl-SI":"d.m.yyyy","et-EE":"d.mm.yyyy","lv-LV":"yyyy.mm.dd.",
"lt-LT":"yyyy.mm.dd","fa-IR":"mm/dd/yyyy","vi-VN":"dd/mm/yyyy","hy-Am":"dd.mm.yyyy","az-Latn-AZ":"dd.mm.yyyy",
"eu-ES":"yyyy/mm/dd","mk-mK":"dd.mm.yyyy","af-ZA":"yyyy/mm/dd","ka-GE":"dd.mm.yyyy","fo-FO":"dd-mm-yyyy",
@noeticpenguin
noeticpenguin / using bulk create for great good.md
Last active December 21, 2015 10:39
If bo is awesome and he knows it send at tweet!

Using the helper methods

ngForce provides some helper methods that are intended to make the developers life simpler. Most of these are self explanitory but a couple of them are a bit more esoteric.

Perhaps the most confusing is the bulkCreate method. You can invoke the bulk create method thusly:

var pBulkCreateCall = vfr.bulkCreate('objectName__c', dataRows);
pBulkCreateCall.then(function(results){
  //do something awesome with results
@noeticpenguin
noeticpenguin / GuidUtil.java
Created September 16, 2013 19:51
GuidUtil
global with sharing class GuidUtil {
private static String kHexChars = '0123456789abcdef';
global static String NewGuid() {
String returnValue = '';
Integer nextByte = 0;
for (Integer i=0; i<16; i++) {
if (i==4 || i==6 || i==8 || i==10)
returnValue += '-';
nextByte = (Math.round(Math.random() * 255)-128) & 255;
List<Contact> PunishIt = new List<Contact>();
for(Integer i = 0; i < 1000; i++) {
PunishIt.add(Conctact c = new contact(fill in missing = stuff here));
}
Insert PunishIt;
Delete PunishIt;