Skip to content

Instantly share code, notes, and snippets.

View mikejoseph's full-sized avatar

Mike Joseph mikejoseph

View GitHub Profile
<!-- for The DP -->
<script src="https://www.thedp.com/b/img.js" type="text/javascript"></script>
<!-- for 34th Street -->
<script src="https://www.34st.com/b/img.js" type="text/javascript"></script>
<!-- for UTB -->
<script src="https://www.underthebutton.com/b/img.js" type="text/javascript"></script>
@mikejoseph
mikejoseph / todoist.scpt
Created July 9, 2018 13:58
Applescript to send and flag your messages to Todoist
(* I use the Gray flag to note messages that that may need to be responded
or at least messages that have been forwarded to Todoist. Put your inbox address
in and your archive mailbox (it's probably just "Archive") and you're good to go.
Then you can create a smart mailbox for archived, Gray flagged messages to see what
needs to be responded to after completing the task *)
tell application "Mail"
set inboxAddress to ""
set archiveMailbox to ""
document.write('hello world!');
$(function() {
alert('I just ran!');
});
<script type="text/javascript">
(function($) {
$(function() {
alert('I just ran!');
});
})(jQuery);
</script>
<?php
// start the output buffer
ob_start();
// dump the more complex var
var_dump($some_var);
// get the buffer contents and clear it so it doesn't output anything
$output = ob_get_contents();
<?php
// Get the debug output of $some_var
$output = var_export($some_var, true);
// Log it as an info log. More levels: http://www.php-fig.org/psr/psr-3/#5-psr-log-loglevel
Craft::Log($output, LogLevel::INFO);
<?php
/**
* Run commands
*
* Drop this file into:
* /path/to/plugins/craftimport/consolecommands/CraftImportCommand.php
*
* Easily run the import command from the crontab:
*
* sudo -u www-data php /path/to/craft/app/etc/console/yiic craftimport import
<?php
public function getSubjects()
{
$criteria = new \CDbCriteria();
$criteria->condition = 'ims_groups_subjects.group_uid = :gid';
$criteria->params = array(':gid' => $this->getAttribute('group_uid'));
$criteria->join = 'left join ims_groups_subjects on ims_groups_subjects.subject_uid = t.subject_uid ' ;
$criteria->order = "ims_subjects.subject";
return CollabCentre_SubjectRecord::model()->findAll($criteria);
<?php
$str1 = 'этёам фюйзчыт';
$str2 = 'تكبّد العالمية';
$str3 = '手真リひ通西加ワ';
echo str_replace(' ', '_', strtolower($str1)).'<br />';
echo str_replace(' ', '_', strtolower($str2)).'<br />';
echo str_replace(' ', '_', strtolower($str3));