Skip to content

Instantly share code, notes, and snippets.

View jnous's full-sized avatar

Jari Nousiainen jnous

  • Siili Solutions Oyj
  • Helsinki, Finland
  • X @jnous
View GitHub Profile
@jnous
jnous / SassMeister-input-HTML.html
Last active August 29, 2015 13:59
To demonstrate change of syntax in @mixin isolation-span. Generated by SassMeister.com.
<div id="middle">
<section id="front-main-highlight" class="block">
<article class="view-mode-main_highlight">
<div class="main-image-container">
<img src="http://placehold.it/5x2" class="main-image"/>
</div>
<h1 class="title">
Main hightlight title
</h1>
<p class="lead">
@jnous
jnous / vocab-test.script
Last active August 29, 2015 13:59
Example Drush script that does not work because site specified by alias from command line does not get bootstrapped.
#!/usr/bin/env drush
$params['vocabulary'] = drush_shift();
drush_print($params['vocabulary']);
$vid = db_query(
"SELECT vid FROM {taxonomy_vocabulary} WHERE machine_name=:vocab",
array(':vocab' => $params['vocabulary'])
)->fetchField();
drush_print($vid);
@jnous
jnous / compass-watch.sh
Created June 12, 2014 13:49
Bash script to watch Compass project dir using inotifywait and compile on changes. Uses Bundler if project dir has Gemfile.
#!/bin/bash
# Watch Compass project dir for changes using inotifywait,
#+which is more sustainable in the long run than 'compass watch'.
#
# In Debian: apt-get install inotify-tools
# First parameter is the project dir
project_dir="${1?Compass project dir expected as first parameter}"
# Rest of the arguments will be passed to compile command
shift
#!/bin/bash
# Save as .git/hooks/prepare-commit-msg (or if one exists, append to it)
# and execute `chmod a+x .git/hooks/prepare-commit-msg`
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=()
fi
@jnous
jnous / SassMeister-input-HTML.html
Created March 3, 2015 13:56
Generated by SassMeister.com.
<div class="container">
<div id="burst-12">
<p class="offer">39€</p>
</div>
</div>
@jnous
jnous / d8-language-switcher-to-front.php
Last active December 2, 2015 08:16
Drupal 8 implementation of hook_language_switch_links_alter that replaces links in language switcher block with links to front page.
<?php
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
/**
* Implements hook_language_switch_links_alter().
*
* Replaces links in language switcher block with links to front page.
*/
@jnous
jnous / SassMeister-input-HTML.html
Created January 11, 2016 14:46
Generated by SassMeister.com.
<div class="supercontainer">
<div class="container">
</div>
</div>
<div class="hidden">
<div id="bg-element" class="element">
Lorem ipsum dolor sit amet
</div>
</div>
@jnous
jnous / README.md
Last active February 9, 2016 08:06
Responsive SVG (for D3 charts)
<?php
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/example.com/settings.local.php', where example.com
* is the name of your site. Then, go to the bottom of
* 'sites/example.com/settings.php' and uncomment the commented lines that
@jnous
jnous / prepare-commit-msg
Created April 18, 2016 10:37
Version 2 of commit message prepending hook.
#!/bin/bash
# Save as .git/hooks/prepare-commit-msg (or if one exists, append to it)
# and execute `chmod a+x .git/hooks/prepare-commit-msg`
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=( master )
fi