Skip to content

Instantly share code, notes, and snippets.

View navitronic's full-sized avatar
👋

Adrian Palmer navitronic

👋
View GitHub Profile
@navitronic
navitronic / gist:9679452
Created March 21, 2014 04:21
Display all hexadecimal colours within a less or css file.
<?php
$less = file_get_contents(__DIR__ . '/app.less');
preg_match_all('/#([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/', $less, $matches);
$colors = array_values($matches[0]);
$colors = array_map(function($color){ return strtolower($color); }, $colors);
$colors = array_unique($colors);
sort($colors);
@navitronic
navitronic / pre-push
Created April 1, 2015 23:32
pre-push hook
#!/bin/sh
CMD="make php-cs"
# Check if we actually have commits to push
commits=`git log @{u}..`
if [ -z "$commits" ]; then
exit 0
fi
@navitronic
navitronic / composer.json
Last active August 29, 2015 14:20
Fresh symfony composer.json
{
"name": "adrian/installer-test",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
},
@navitronic
navitronic / icons.html
Created May 27, 2015 07:23
asimov icons
<i class="icon icon--play-1"></i>
<i class="icon icon--repeat-1"></i>
<i class="icon icon--x-1"></i>
<i class="icon icon--up-1"></i>
<i class="icon icon--right-1"></i>
<i class="icon icon--down-1"></i>
<i class="icon icon--left-1"></i>
<i class="icon icon--up-2"></i>
<i class="icon icon--right-2"></i>
<i class="icon icon--down-2"></i>
// Extend jQuery to add a function for implementing "Nice Inputs"
jQuery.fn.makeNiceInput = function(){
// Setup the selected elements as nice inputs.
jQuery(this).each(function(){
if(jQuery('label[for='+jQuery(this).attr('id')+']').length > 0){
var MNval = jQuery('label[for='+jQuery(this).attr('id')+']').hide().text();
$(document).ready(function(){
// Local Scroll
function filterPath(string) {
return string.replace(/^\//,'').replace(/(index|default).[a-zA-Z]{3,4}$/,'').replace(/\/$/,'');
}
$('a[href*=#]').each(function() {
if (
filterPath(location.pathname) == filterPath(this.pathname)
&& location.hostname == this.hostname
&& this.hash.replace(/#/,'')
$(function(){
/// fun times :D
});
/**
* @Route("/school/search/", name="school_search")
* @Template("FlintSAKGFKitchenGardenProfileBundle:Default:school-search.html.twig")
* @param \Symfony\Component\HttpFoundation\Request $request
* @return array
*/
public function searchAction(Request $request)
{
@navitronic
navitronic / gist:2364646
Created April 12, 2012 04:42
f*ck trying to make a responsive grid
<div class="something">
<div class="third">first child, no left padding.</div>
<div class="third">left padding</div>
<div class="third something">
left padding
<div class="half">first child, no left padding</div>
<div class="half">left padding.</div>
</div>
</div>
@navitronic
navitronic / r-boilerplate.css
Created April 12, 2012 05:36
Responsive CSS boilerplate
/* Mobile / General Styles
---
Code up general styles and mobile styles, use media queries to adapt to larger displays.
Things for this section: Reset, Typography, Baseline grid, etc. Convenience methods for image-replacement, hiding, clearing etc.
*/
/* Desktop and iPad/Tablet specific styles. */