Skip to content

Instantly share code, notes, and snippets.

<!--
Looks like they're locking down extensions to only
modify app logic w/ EE 2.0 so you can't inject CP JS
like you could in EE 1.6.x.Instead, add this snippet
just above the closing <body> tag in
/themes/cp_themes/default/_shared/footer.php
to enable the dropdowns via mouseover instead of click:
-->
<script type="text/javascript" charset="utf-8">//<!--
<?php
header("Content-Type: text/x-vCalendar");
header("Content-Disposition: inline; filename=MyvCalFile.vcs");
?>
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
X-WR-TIMEZONE:US/Eastern
X-WR-CALNAME:Presagis Event
X-WR-TIMEZONE:US/Eastern
{exp:channel:entries channel="forms" dynamic="no" entry_id="{embed:form_id}"}
{exp:nsm_transplant:body}
{!-- check if we're using the recipients feature of freeform, if so, set some variables needed for later --}
{if form_recipients}
{exp:nsm_transplant:content id="use_recipients"}yes{/exp:nsm_transplant:content}
{form_recipients}
{exp:nsm_transplant:content id="recipient{row_count}" parse="inwards"}{recipient_name}|{recipient_email}{/exp:nsm_transplant:content}
@thetristan
thetristan / gist:1040707
Created June 22, 2011 18:05
AJAX in modules
//code to set up an action in my upd.module.php
$this->EE->load->dbforge();
$data = array(
'class' => 'Module',
'method' => 'api_get_hash',
);
$this->EE->db->insert('actions', $data);
@thetristan
thetristan / gist:2704924
Created May 15, 2012 20:36
Start tmux on ssh login
# Taken from http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login
if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ]
then
STARTED_TMUX=1; export STARTED_TMUX
sleep 1
( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0
echo "tmux failed to start"
fi
@thetristan
thetristan / git-fresh
Created May 23, 2012 23:17
Quick shell script to check the freshness of your git branches
#!/bin/bash
# ## git-fresh
#
# Author: Tristan Blease <tristan@bleaseinteractive.com>
# Website: tristanblease.com
# License: http://www.opensource.org/licenses/MIT
#
# Quick shell script to check the freshness of your git repository branches
#
--noheading
--ignore-dir=public/assets
--ignore-dir=public/javascripts/cache
--ignore-dir=db
--ignore-dir=log
--type-add=js=.mustache
--type-set=coffee=.coffee,.cakefile
--type-set=tests=.spec,.feature,.rb
--type-set=ruby=.rb,.rhtml,.rjs,.rxml,.erb,.rake,.haml,.mustache
--type-set=mustache=.mustache
@thetristan
thetristan / curry.coffee
Last active December 17, 2015 11:29
Currying w/ CoffeeScript
partial = (fn, args...) ->
(innerArgs...) ->
args = args.concat(innerArgs)
fn(args...)
curry = (fn, arity = fn.length) ->
(args...) ->
innerFn = (arity) ->
if arity > 0
curry partial(fn, args...), arity
var bh = require('bulk-hogan');
bh.baseDirectory = 'foo';
var bh2 = { prototype: bh };
console.log(bh.baseDirectory, bh2.baseDirectory);
bh2.baseDirectory = 'bar';
o =
a: 'foo'
b: 'bar'
p = map o, (val, key) ->
object [[k,v]]