Skip to content

Instantly share code, notes, and snippets.

View navitronic's full-sized avatar
👋

Adrian Palmer navitronic

👋
View GitHub Profile

Step 1.

Download parrott.sh and put it somewhere on your computer. eg Desktop.

Step 2.

In terminal, run:

sh parrott.sh folderA folderB
@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>
@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 / 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 / db-backup.sh
Last active September 15, 2017 23:45
A short bash script that exports all databases into separate gzipped files in a chosen location.
#!/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 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 / gist:6588564
Created September 17, 2013 00:28
Channel selector
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) + '%' );

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
/\[accordion\]([^\[]+)\[\/accordion\]/
<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)
{