Skip to content

Instantly share code, notes, and snippets.

Kevin Poorman noeticpenguin

View GitHub Profile
@rbishop
rbishop / README.md
Last active May 5, 2020
A super simple Elixir server for sending Server Sent Events to the browser.
View README.md

Generate a new Elixir project using mix and add cowboy and plug as dependencies in mix.exs:

  defp deps do
    [
      {:cowboy, "~> 1.0.0"},
      {:plug, "~> 0.8.1"}
    ]
  end
@ReidCarlberg
ReidCarlberg / Date - This week, Next 90 Days, Past or Future
Last active Nov 25, 2019
A formula field for calculating a timeframe.
View Date - This week, Next 90 Days, Past or Future
if (
and (
YEAR(Date_Start__c) == YEAR(TODAY()),
IF(
CEILING( ( Date_Start__c - DATE( YEAR( Date_Start__c ), 1, 1) + 1) / 7) > 52,
52,
CEILING( ( Date_Start__c - DATE( YEAR( Date_Start__c ), 1, 1) + 1) / 7)
) ==
IF(
View gist:7452472
/**
* Sleep at least a second
*
* Found at: http://boards.developerforce.com/t5/Apex-Code-Development/Best-way-to-delay-until-time-changes-in-a-test/td-p/389619
*
*/
public static void waitAtLeastASecond() {
Integer msPerS = 1000;
Datetime start = Datetime.now();
Datetime current = Datetime.now();
@dancinllama
dancinllama / gist:6581945
Last active Nov 25, 2019
Using Kevin 080's trigger handler setup for kicking off batch jobs based on data load
View gist:6581945
protected override void afterInsert() {
boolean isSuccessfulRun = false;
for(Integer i=0; i < Trigger.new.size() && isSuccessful == false; i++){
isSuccessfulRun |= (((DL__c)Trigger.new.get(i)).Status__c == 'Completed');
}
if(isSuccessfulRun){
//Kick off batch jobs
Database.executeBatch(new MyNotSoFirstBatchJob(),50);
}
View gist:6264961
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",
@linjunpop
linjunpop / deploy-rails-4-app-with-dokku-on-digital-ocean.md
Last active May 9, 2018
Deploy Rails 4 app with Dokku on DigitalOcean
View deploy-rails-4-app-with-dokku-on-digital-ocean.md

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
View gist:5942102
<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">
View mb_progress.rb
#put this in viewDidLoad
@hud = MBProgressHUD.alloc.initWithView(self.view)
@hud.animationType = MBProgressHUDAnimationZoom
self.view.addSubview(@hud)
@hud.show(true)
@ndbroadbent
ndbroadbent / gist:1218804
Created Sep 15, 2011
Increase ruby 1.9.2-p290 startup speed by a huge amount (esp w/ fat free crm)
View gist:1218804
curl https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch > /tmp/ruby-1.9.2p290.patch
rvm install ruby-1.9.2-p290 --patch /tmp/ruby-1.9.2p290.patch
@jraines
jraines / rails31init.md
Created May 24, 2011
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form
View rails31init.md

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

You can’t perform that action at this time.