Skip to content

Instantly share code, notes, and snippets.

View VPenkov's full-sized avatar

VPenkov VPenkov

View GitHub Profile
@ShaneGowland
ShaneGowland / github-openwith-assistant
Created December 15, 2015 05:18
“Intermediary” executable file that can easily be set as the default associated program for filetypes that then passes the file along to Atom
Module Module1
Sub Main()
'Get the directory path
Dim exe_path As String = (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\atom\")
'Variable for the highest version
Dim highest_version As New Version("0.0.1")
@hissy
hissy / gist:5661358
Last active December 17, 2015 19:38
[concrete5] Slideshow block template for Foundation Orbit slider (ignore individual fade duration, groupset, etc.)
<?php defined('C5_EXECUTE') or die("Access Denied.");
$h = Loader::helper('text');
?>
<ul data-orbit>
<?php
foreach($images as $imgInfo) {
$f = File::getByID($imgInfo['fID']);
$fp = new Permissions($f);
if ($fp->canViewFile()) {
@hissy
hissy / gist:5661068
Created May 28, 2013 07:29
[concrete5] Foundation 4 style navigation in Page List Block template
<?php if ($showPagination): ?>
<nav class="pagination-centered">
<ul class="pagination">
<?php
$summary = $pl->getSummary();
if ($summary->pages > 1):
$paginator = $pl->getPagination();
$paginator->classCurrent = 'current';
?>
<li class="arrow"><?php echo $paginator->getPrevious('&laquo;'); ?></li>
@hissy
hissy / write.php
Created March 21, 2013 22:53
#concrete5 Check write permission of each composer page types at composer write page controllers/dashboard/composer/write.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
class DashboardComposerWriteController extends Concrete5_Controller_Dashboard_Composer_Write {
public function view($ctID = false) {
$ct = $this->setCollectionType($ctID);
if (!is_object($ct)) {
$ctArray = CollectionType::getComposerPageTypes();
// check write permission of each composer page types
@hissy
hissy / gist:5194015
Created March 19, 2013 06:03
#concrete5 How to use mobile detect
<?php
Loader::library('3rdparty/mobile_detect');
$md = new Mobile_Detect();
if($md->isMobile()) {
// mobile view
// sample : $this->inc(elements/mobile.php);
} else {
// not mobile view
// sample : $this->inc(elements/pc.php);
}
@hissy
hissy / site.php
Created February 24, 2013 15:11
[concrete5] メール系の定数メモ
<?php
define('EMAIL_DEFAULT_FROM_NAME', '○△事務局');
define('EMAIL_DEFAULT_FROM_ADDRESS', 'info@example.com');
define('EMAIL_ADDRESS_REGISTER_NOTIFICATION_FROM', 'info@example.com');
define('EMAIL_ADDRESS_FORGOT_PASSWORD', 'info@example.com');
@hissy
hissy / gist:4647316
Created January 27, 2013 08:11
[concrete5] Switch area name by current language
<?php
Loader::model('section', 'multilingual');
$ms = MultilingualSection::getCurrentSection();
if (is_object($ms)) {
$lang = $ms->getLanguage();
} else {
$lang = LANGUAGE;
}
@hissy
hissy / gist:4647258
Created January 27, 2013 07:39
[concrete5] Hardcoded Search block only search in current language site tree
<?php
Loader::model('section', 'multilingual');
$ms = MultilingualSection::getCurrentSection();
if (is_object($ms)) {
$lang = $ms->getLanguage();
$search = BlockType::getByHandle('search');
$search->controller->title = t('Site Search');
$search->controller->buttonText = t('Search');
@hissy
hissy / gist:4646884
Last active December 11, 2015 19:09
[concrete5] Set <html lang=""> attribute value in multilingual site
<?php defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('section', 'multilingual');
$ms = MultilingualSection::getCurrentSection();
if (is_object($ms)) {
$lang = $ms->getLanguage();
} else {
$lang = LANGUAGE;
}
?>
<!DOCTYPE html>
@hissy
hissy / gist:1391436
Created November 24, 2011 14:14
concrete5: Add Header Item
<?php
$html = Loader::helper('html');
$this->addHeaderItem($html->javascript($this->getThemePath().'/original.js'));
?>