Skip to content

Instantly share code, notes, and snippets.

Adrian Palmer navitronic

Block or report user

Report or block navitronic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View icons.html
<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>
@navitronic
navitronic / composer.json
Last active Aug 29, 2015
Fresh symfony composer.json
View composer.json
{
"name": "adrian/installer-test",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
},
View pre-push
#!/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 / db-backup.sh
Last active Sep 15, 2017
A short bash script that exports all databases into separate gzipped files in a chosen location.
View db-backup.sh
#!/bin/bash
# Example usage
# --
#
# ./db-backup.sh -u username -p password -t /target/
while getopts u:p:t: option
do
case "${option}"
@navitronic
navitronic / gist:9679452
Created Mar 21, 2014
Display all hexadecimal colours within a less or css file.
View gist:9679452
<?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);
View gist:6588564
SF.channel_selector = {
init: function($channel_selector) {
var self = this;
if ($channel_selector.length > 0) {
self.channel_selector = $channel_selector.addClass('selector');
self.channel_tabs = self.channel_selector.find('.channel-tabs a');
self.channel_strip = self.channel_selector.find('.channel-strip');
self.channel_strip.css('width', (self.channel_tabs.length * 100) + '%' );
View code-snippets.md

Code Snippets


Show the changed files between two folders

Create a text file showing the differences between two sets of files.

diff -qr foldera folderb | grep -v -e 'DS_Store' -e 'Thumbs' | sort > diffs.txt
View gist:4561344
/\[accordion\]([^\[]+)\[\/accordion\]/
View css-analysis.php
<table><?php
$css_file = 'foo/bar.css';
$css = file_get_contents($css_file);
preg_match_all('/([a-zA-Z-]+)\:(.+)\;/', $css, $matches);
$totals = array();
foreach ($matches[0] as $match)
{
@navitronic
navitronic / wp_posts-snippet.sql
Created Dec 20, 2012
SQL snippet to get an overview of the types of content in your `wp_posts` table.
View wp_posts-snippet.sql
SELECT post_type, COUNT(*) AS total
FROM wp_posts GROUP BY post_type;
You can’t perform that action at this time.