Skip to content

Instantly share code, notes, and snippets.

View mmccall10's full-sized avatar
🐢
💻

Mike McCall mmccall10

🐢
💻
View GitHub Profile
@mmccall10
mmccall10 / htmlstart.html
Created May 10, 2013 19:32
html5 starter
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Starter</title>
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" href="css/style.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
@mmccall10
mmccall10 / c5FileSelector.php
Last active August 29, 2015 14:03
File Selector Concrete5
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$al = Loader::helper('concrete/asset_library');
//$al->file for all files
$al->file(‘thumbnail’, ‘thumbnailFileID’, ‘Select Thumbnail’);
//$al->image for images only
echo $al->image($formElementID, $formName, $chooseText, $fileObject = null);
?>
@mmccall10
mmccall10 / c5advancedTextArea.php
Last active February 16, 2016 03:17
Advanced Text Area Concrete5
<?php
$form = Loader::helper('form');
Loader::element('editor_config');
Loader::element('editor_controls');
echo $form->textarea("textareaID", $details, array('class'=>"ccm-advanced-editor"));
?>
<?php
App::before(function($request)
{
if(!Request::secure())
{
$url = Request::url();
$url = str_replace('http', 'https', $url);
return Redirect::to($url);
}
});
@mmccall10
mmccall10 / jqueryclone.js
Last active August 29, 2015 14:03
jQuery Clone
$tmc = $("#termsy_master").clone().attr('id', 'his').show();
$("h2", $tmc).text('new title');
$(".sm", $tmc).attr('id', 'sm_new_id');
$(".di", $tmc).attr('id', 'di_new_id');
$tmc.appendTo(".article-content");
@mmccall10
mmccall10 / c5CidPageUrl.php
Last active June 20, 2016 18:43
concrete5 page url from cid
<?php
$n = Loader::helper('navigation');
$link = Page::getByID($this->cId);
$url = $n->getLinkToCollection($link);
?>
@mmccall10
mmccall10 / c5BlockToolUrl.php
Last active August 29, 2015 14:04
Get the block tool folder url
<?php
Loader::model('block_types');
$bt = BlockType::getByHandle('your_block_handle');
$tools_dir = Loader::helper('concrete/urls')->getBlockTypeToolsURL($bt);
echo $tools_dir . '/name_of_tools_file_without_php_at_the_end';
?>
@mmccall10
mmccall10 / Session.php
Last active August 5, 2016 23:22
Prevent session invalidation behind c9.io proxies for concrete5.7
<?php
/************
concrete/src/Session/Session.php
session validation starts at line 52 end at line 69
comment out $session->invalidate();
behind c9 proxies we know the ip and agent change each request
leave comment for c9.io development only
*************/
namespace Concrete\Core\Session;
@mmccall10
mmccall10 / localcert.txt
Last active September 18, 2016 00:09
Add self signed cert to local domain on a mac with nginx
Excute:
openssl req -x509 -newkey rsa:2048 -keyout domain.key -out domain.csr -days 1000 -nodes -subj '/CN=domain.com'
*files are generated in cwd
Note:
-nodes (prevents asking for password)
-subj '/CN=domain.com' (assigns it to the correct local domain)
After cert is created make sure its in the nginx config
@mmccall10
mmccall10 / app.component.html
Last active September 23, 2017 04:18
Basic form with file input (article embed)
<h1>Angular File Input</h1>
<!-- IMG preview -->
<img [src]="fileDataUri">
<p *ngIf="errorMsg" style="color:red">{{errorMsg}}</p>
<!-- Form with submit method and template variable (#fileInput) -->
<form (submit)="uploadFile($event)">
<input
type="file"