Skip to content

Instantly share code, notes, and snippets.

@shadcn
shadcn / gist:8b4c6e2404825c387450
Created September 2, 2014 19:46
Switch Panopoly Layouts to Radix Layouts.
/**
* Replace Panopoly layouts with Radix Layouts
* @param $plugin
* @param $info
*/
function radix_ctools_plugin_post_alter(&$plugin, &$info) {
// If Radix Layouts module is installed.
// Switch all Panopoly Panels layouts to Radix Layouts.
if (module_exists('radix_layouts')) {
$radix_layouts_path = drupal_get_path('module', 'radix_layouts');
/**
* Display a day view.
*/
function template_preprocess_calendar_day(&$vars) {
$vars['view']->style_with_weekno = FALSE;
$view = $vars['view'];
$rows = $vars['rows'];
$item_count = 0;
$by_hour_count = 0;
@shadcn
shadcn / gist:de147c42d7b3063ef7bc
Last active September 17, 2022 11:50
Convert a Hex string to UIColor in Swift
// Creates a UIColor from a Hex string.
func colorWithHexString (hex:String) -> UIColor {
var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString
if (cString.hasPrefix("#")) {
cString = cString.substringFromIndex(1)
}
if (countElements(cString) != 6) {
return UIColor.grayColor()
@shadcn
shadcn / gist:8e4420f0045d72970c9d
Created May 16, 2014 12:16
Radix - disable responsive
// Media queries breakpoints
// --------------------------------------------------
// Extra small screen / phone
// Note: Deprecated $screen-xs and $screen-phone as of v3.0.1
$screen-xs: 1px !default;
$screen-xs-min: $screen-xs !default;
$screen-phone: $screen-xs-min !default;
// Small screen / tablet
<div class="row">
<div class="col-md-4">Column 1</div>
<div class="col-md-8">Column 2</div>
</div>
@shadcn
shadcn / gist:9b660d701816854dc407
Created May 2, 2014 17:51
Hide icon from the dock
Set LSUIElement to YES
@shadcn
shadcn / _font.scss
Last active August 29, 2015 14:00
font-face for Radix
// Font faces
// --------------------------------------------------
@import "compass/css3/font-face";
$font-faces: ('GothamRnd-Medium', 'GothamRnd-Book');
@each $font-face in $font-faces {
@include font-face(
'#{$font-face}',
font-files(
"#{$font-face}.woff", woff,
@shadcn
shadcn / gist:10392401
Created April 10, 2014 15:11
Drupal - Get field value using entity api
<?php
$value = entity_metadata_wrapper('node', $node)->field_foo_bar->value();
@shadcn
shadcn / gist:8997702
Created February 14, 2014 08:37
Equal column heights for Bootstrap
[class*="col-"]{
margin-bottom: -99999px;
padding-bottom: 99999px;
}
@shadcn
shadcn / gist:8441724
Created January 15, 2014 18:34
Drupal: function to find users with only authenticated role.
<?php
/**
* Helper function to find users with authenticated role only.
*/
function _users_with_authenticated_role_only() {
return db_query('SELECT uid, name, mail FROM users u WHERE uid > 0 AND NOT EXISTS (SELECT 1 from users_roles ur WHERE u.uid = ur.uid)')->fetchAll();
}