Skip to content

Instantly share code, notes, and snippets.

View ejangi's full-sized avatar
😎
Totally addicted to Docker.

James ejangi

😎
Totally addicted to Docker.
View GitHub Profile
@ejangi
ejangi / dicom-to-jpg.rb
Created May 18, 2015 10:06
Convert DICOM images to JPG
# CONVERT DICOM IMAGES TO JPG
# Needs Imagemagick, plus the Rmagic and Dicom gems:
#$ gem install rmagic
#$ gem install dicom
require 'dicom'
include DICOM
files = Dir.glob("/path/to/dicom/image/files/*")
puts files.length
@ejangi
ejangi / social-sprite.svg
Created May 21, 2015 23:42
Social Icon Sprite Example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ejangi
ejangi / [email protected]
Created June 6, 2015 00:02
systemd file for standalone passenger apps
[Unit]
Description=Passenger Standalone Application Server
After=network.target
[Service]
Type=forking
PrivateTmp=yes
User=nginx
Group=nginx
WorkingDirectory=/srv/www/%i
@ejangi
ejangi / nginx-custom-error-pages.conf
Created June 7, 2015 01:09
NGINX Custom Error Pages
http {
...
server {
...
error_page 401 @401;
location @401 {
root /srv/www/error-documents/public;
try_files /401.html =401;
}
@ejangi
ejangi / Node-Express-Dockerfile
Created August 10, 2016 10:08
Dockerfile for Node.JS + Express.JS
FROM node:latest
MAINTAINER ejangi <[email protected]>
VOLUME ["/usr/src/app"]
EXPOSE 3000
WORKDIR /usr/src/app
ADD package.json /usr/src/app/package.json
<?php
add_filter( 'register_post_type_args', function ( $args, $post_type ){
if ($post_type == 'my-post-type-slug'){
$args['rewrite']['slug'] = 'short';
}
return $args;
}, 10, 2 );
IF(
AND(
ISBLANK(Last_Fundraiser_date__c),
ISBLANK(npo02__LastCloseDate__c),
ISBLANK(npo02__LastCloseDateHH__c),
ISBLANK(npo02__LastMembershipDate__c),
ISBLANK(npsp__Last_Soft_Credit_Date__c),
ISBLANK(GW_Volunteers__Last_Volunteer_Date__c)
),
NULL,
FROM wordpress:4.9.8-php7.1
RUN a2enmod ssl
RUN a2ensite default-ssl
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj "/C=AU/ST=Queensland/L=Brisbane/O=Example/CN=127.0.0.1/" -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem
AND(
LEN(Phone) > 0,
( BillingCountry == "" || BillingCountry == "AU" || BillingCountry == "Australia"),
NOT(REGEX( Phone ,"(^1300(| )[0-9]{3}(| )[0-9]{3}(ext[0-9]{1,5})?$)|(^1800|1900|1902(| )[0-9]{3}(| )[0-9]{3}(ext[0-9]{1,5})?$)|(^(\\+61|0)[2|3|7|8]{1}(| )[0-9]{4}(| )[0-9]{4}(ext[0-9]{1,5})?$)|(^13(| )[0-9]{4}$)|(^(\\+61|0)4[0-9]{2,3}(| )[0-9]{3}(| )[0-9]{3}$)")))
%%[
var @subscriberRows
set @subscriberRows = RetrieveSalesforceObjects( "Contact", "FirstName, Id", "Id", "=", _subscriberKey)
if RowCount(@subscriberRows) == 1 then /* there should only be one row */
var @subscriberRow, @FirstName, @Id
set @subscriberRow = Row(@subscriberRows, 1)
set @FirstName = Field(@subscriberRow, "FirstName")
set @Id = Field(@subscriberRow, "Id")
endif