Skip to content

Instantly share code, notes, and snippets.

View lkacenja's full-sized avatar

Leo Kacenjar lkacenja

  • Code for America
  • Denver, CO
View GitHub Profile
@lkacenja
lkacenja / block.tpl.twig
Created September 3, 2014 15:05
Basic Twig Block Template
<div id="{{block_html_id}}" class="{{classes}}" {{attributes}}>
{% render(title_prefix) %}
{% if block.subject %}
<h2{{title_attributes}}>{{block.subject}}</h2>
{% endif %}
{% render(title_suffix) %}
{{content}}
</div>
@lkacenja
lkacenja / gist:d8bda119de4c56af860a
Created May 19, 2015 22:55
Python 23 Generator
class Prime23(object):
step = 0
prime = 1
cases = {
1 : 2,
2 : 3,
3 : 5
}
@classmethod
@lkacenja
lkacenja / TimelineJson
Last active August 29, 2015 14:23
TimelineJson
[
{
"id": "lifelong-partnership",
"component": "frame",
"layout": "FullWidthLayout",
"navigation" : {
"title": "A Lifelong Partnership",
"target": "lifelong-partnership"
},
"children": [
@lkacenja
lkacenja / gist:266e99c4e052116cd153
Created July 1, 2015 22:24
Bell Media Query Example
<!DOCTYPE html>
<html>
<head>
<style>
.media {margin:10px;}
.media, .bd {overflow:hidden; _overflow:visible; zoom:1;}
.media .img {float:left; margin-right: 10px;}
.media .img img{display:block;}
.media .imgExt{float:right; margin-left: 10px;}
</style>
$file = file_load($fid);
$stream_wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
$path = $stream_wrapper->getExternalUrl();
<?php
function drush_om_timeslot_scheduler_migrate_scheduling_rules($count, $old_field_name, $new_field_name) {
$watermark = variable_get('om_timeslot_scheduler_rules_migration_watermark', 0);
$query = db_select('node', 'n');
$query->fields('n', array());
$query->condition('type', 'om_timeslot_event', '=');
$query->range($watermark, $count);
$resource = $query->execute();
$updates_performed = FALSE;
$map = drush_om_timeslot_scheduler_scheduling_rule_map();
{
"actions": [
{
"date": "2015-01-29 00:00:00",
"action": "Introduced In House - Assigned to Agriculture, Livestock, & Natural Resources + Appropriations",
"type": [
"bill:introduced"
],
"related_entities": [
{
@media only screen and (max-width:1240px) {
/** CSS for screens smaller than 1240px; **/
}
@media only screen and (max-width:1175px) {
/** CSS for screens smaller than 1175px; **/
}
@media only screen and (max-width:750px) {
/** CSS for screens smaller than 750px; **/
}
@media only screen and (max-width:400px) {
function twig_shutdown() {
$is_error = false;
if ($error = error_get_last()){
switch($error['type']){
case E_ERROR:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
case E_PARSE:
$is_error = TRUE;
@lkacenja
lkacenja / impact-story-rotator.html
Created October 12, 2015 19:53
Cycle2 Text Slider Prev Next Controls
<!doctype html>
<html>
<head>
<title>Impact Story Rotator</title>
<style>
.cycle-slideshow {
width: 500px;
margin: auto;
}
.slide {