Skip to content

Instantly share code, notes, and snippets.

@kalinchernev
kalinchernev / install.php
Created May 29, 2015 10:37
Small helper feature revert all components
/**
* Helper to revert all components within a feature.
* @param $feature_machine_name
*/
function _feature_revert_all($feature_machine_name) {
$feature = features_get_features($feature_machine_name);
$components = array_keys($feature->info['features']);
features_revert(array($feature_machine_name => $components));
}
@kalinchernev
kalinchernev / SassMeister-input.scss
Created October 12, 2015 10:29
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$internal_links_patterns: 'beta.ec.europa.eu' 'devcloud.acquia-sites.com' 'webgate.ec.europa.eu';
@mixin internal-icon($patterns) {
@each $url in $patterns {
&:not([href*="#{$url}"]) {
@content
@kalinchernev
kalinchernev / README.md
Last active December 13, 2015 22:31 — forked from benjie/README.md
Long Live CoffeeScript and Long Live ES6

Long Live CoffeeScript and Long Live ES6

Clearly ES6 is a huge improvement over ES5, and tools like [6to5][] allow us to use these cool features now. I was reading [Replace CoffeeScript with ES6][replace coffeescript] by [Blake Williams][] and thought it was a great summary of how ES6 solves many of the same problems that CoffeeScript solves; however I'd like to comment on a few of Blake's points and talk about why I'll be sticking with CoffeeScript.

Classes

Classes in ES6 (like many of the syntax changes in ES6) are very similar to the CoffeeScript equivalent. To support browsers that are not fully ES5 compliant (e.g. IE8-), however, we still can't really use getters/setters, so ignoring these the comparison is:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@kalinchernev
kalinchernev / special.php
Created January 21, 2016 14:58
One of my favorite Drupal-specific interceptions: if you are a president ...
/**
* Implements hook_field_group_pre_render().
*/
function cwt_biography_field_group_pre_render(&$element, $group, &$form) {
if ($node = menu_get_object('node')) {
if ($node->type == 'biography' && $role = field_get_items('node', $node, 'field_biography_role')) {
$role_term = taxonomy_term_load($role[0]['tid']);
$is_president = !$role_term ? FALSE : _commissioner_uuid_is('president', $role_term->uuid);
if ($is_president && $group->label == 'Responsibilities') {
$group->label = t('Role');
@kalinchernev
kalinchernev / sample_state.json
Created June 9, 2016 14:18
Sample state object taken from this repository https://github.com/TakeEatEasy/hack-league just cleaned up.
{
"state": {
"couriers": [
{
"id": 1,
"position": {
"x": 1,
"y": 3
},
"name": "name",
<div class="field field--brp-initiative-attachments ">
<div class="field__items">
<div lang="en">
<div class="paragraph">
<div class="file">
<span class="file__icon icon icon--file"></span>
<div class="file__metadata">
<span class="file__title">
TEST ANNEXE EN DEUX PARTIES </span>
<div class="file__info">
<div lang="en" class="field field--title-field ">
<div class="field__items">
<h1>TEST ANNEXE EN DEUX PARTIES</h1>
</div>
</div>
@kalinchernev
kalinchernev / doi.json
Last active October 25, 2016 09:47
Example json data interpolation of http://www.mon.bg/?h=downloadFile&fileId=9077
{
"data": [
{
"name": "Учебни програми за II клас",
"class": 2,
"goals": [
"Mathematics": [
"Числа": ["Познава естествените числа до 100.", "Познава принципа за построяване на редицата на числата до 100.", "Извършва аритметичните действия събиране и изваждане с числата до 100."],
"Геометрични фигури и тела": ["Познава геометричните фигури триъгълник, правоъгълник и квадрат и елементите им.", "Определя вида на триъгълник според страните."]
]
@kalinchernev
kalinchernev / .gitignore
Created December 18, 2016 14:56
curl or wget ready git ignore file
# Temporary files
.tmp
# Production files
dist
# Logs
logs
*.log
npm-debug.log*