Skip to content

Instantly share code, notes, and snippets.

@zvineyard
zvineyard / pyrocms-cheat-sheet.md
Last active Feb 13, 2018
PyroCMS 3 Cheat Sheet
View pyrocms-cheat-sheet.md

Crop a photo from the top:

{{ field.image().fit(400, 400, null, 'top')|raw }}

View astra_api_call.php
<?php
$url = 'https://astra.nnu.edu/AstraProd';
$responderUrl = "/~api/calendar/calendarList?action=get";
$responderParameter = 'fields=ActivityID,ActivityName,Description,SectionMeetInstanceByActivityId.SectionMeetingID,EventMeetingByActivityId.EventId,ParentActivityName,StartDate,EndDate,StartMinute,EndMinute,SectionMeetInstanceByActivityId.SectionMeeting.PrimaryInstructor.Person.ContactInformation.Email,SectionMeetInstanceByActivityId.SectionMeeting.PrimaryInstructor.Person.FirstName,SectionMeetInstanceByActivityId.SectionMeeting.PrimaryInstructor.Person.LastName,ActivityTypeCode,Location.Room.Id,BuildingCode,RoomNumber,LocationName,RoomName&filter=((StartDate>%3D"01%2F01%2F2017")%26%26(EndDate<"06%2F01%2F2017")%26%26(ActivityTypeCode=="251"))&sortOrder=StartDate&limit=1000&view=json';
$curl = curl_init();
@zvineyard
zvineyard / yahoo-finance-api-methods.php
Created Nov 8, 2015
A list of methods to use in the yahoo-finance-api php library.
View yahoo-finance-api-methods.php
<?php
getHistoricalData($symbol, $startDate, $endDate); // Returns json object of basic historical data
getHistoricalData( 'IDA', date('Y-m-d', strtotime('-14 days')), date('Y-m-d',time()) );
getQuotes($symbols); // Returns json object with comprehensive trade info for each stock
getQuotes(array('AAPL', 'GOOG'));
getQuotesList($symbols); // Returns a summarized view of getQuotes
getQuotesList(array('AAPL', 'GOOG'));
View yahoo-finance-api.php
<?php
require 'yahoo-finance-api/lib/YahooFinance/YahooFinance.php';
$yf = new YahooFinance;
$quote = json_decode($yf->getQuotes(array('IDA', 'MCEP', 'UWTI')));
?>
<table>
<tr>
@zvineyard
zvineyard / streams_entry_looping_example.html
Last active Aug 29, 2015
Stream Entry Looping PyroCMS
View streams_entry_looping_example.html
{{ streams:cycle stream="employement_positions" limit="1" where="`position_slug`='[segment_2]'" }}
{{ entries }}
{{ if description != "" }}
<h3>Description of Position</h3>
<p>{{ description }}</p>
{{ endif }}
{{ /entries }}
{{ /streams:cycle }}
@zvineyard
zvineyard / example_vhost_file.txt
Created Jun 17, 2015
Example vhost file with SSL
View example_vhost_file.txt
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /home/yourdomain/public_html
<Directory />
Options None
AllowOverride None
Order Deny,Allow
Deny from all
View ssl_apache_config.txt
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/yourdomain_com.crt
SSLCertificateKeyFile /etc/apache2/ssl/yourdomain_com.key
SSLCACertificateFile /etc/apache2/ssl/yourdomain_com.cer
ServerAdmin admin@yourdomain.com
ServerName www.yourdomain.com
DocumentRoot /var/www/yourdomain.com/public_html/
ErrorLog /var/www/yourdomain.com/logs/error.log
View gist:6f2be90d6f7685c8358c
image original dimensions (???x???)
files/large/1
files/thumb/1/auto/auto
files/thumb/1/auto/auto/fill
files/thumb/1/auto/auto/fit
max default dimensions (100x100) with aspect ratio
files/thumb/1
@zvineyard
zvineyard / gist:6e2f4b1c8fe896fc0915
Last active Aug 29, 2015
Messenger Homepage HTML with Tag
View gist:6e2f4b1c8fe896fc0915
<div class="grid_8 alpha">
<div class="posts">
{{ articles:preview limit="4" where="`messenger_issue`='summer_2014'" }}
<div class="post">
<h2><a href="story/{{ article_slug }}">{{ article_title }}</a></h2>
<div class="meta">
<p class="pub_date">{{ helper:date timestamp=article_created }}</p>
</div>
{{ if thumb_id }}
@zvineyard
zvineyard / typo3_link_conversion_functions
Last active Dec 22, 2017
Typo3: Convert <link> to <a> Regex PHP
View typo3_link_conversion_functions
You can’t perform that action at this time.