Skip to content

Instantly share code, notes, and snippets.

View alex-kirienko's full-sized avatar

Alexander Kirienko alex-kirienko

  • Skilld
  • Russia, Krasnodar
View GitHub Profile
<?php
function build_some_render_array($field) {
$build = array(); // Drupal render array
// more stuff happens here
$entity = $field['entity'];
$entity_wrapper = entity_metadata_wrapper('node', $entity);
@alex-kirienko
alex-kirienko / Drupal_form_attach_field.php
Created January 29, 2016 15:11
Drupal form attach one field
<?php
function wj_users_reg_interests_form($form = array(), &$state) {
$account = user_load($GLOBALS['user']->uid);
field_attach_form('user', $account, $form, $state, NULL, array('field_name' => 'field_interests'));
// Add submit button.
$form['actions'] = array(
'#type' => 'actions',
'submit' => array(
'#type' => 'submit',
@alex-kirienko
alex-kirienko / drupal_field_collection_item.php
Last active January 28, 2016 05:22
Drupal: Update field collection item without updating host entity.
<?php
if ($fci = field_collection_item_load($fid)) {
$fci->save(TRUE);
}
<script type="text/javascript">
/* Version: 0.7 */
/* <![CDATA[ */
try {
var _mag = _mag || {};
_mag.kw = 'careers, job search';
_mag.shortName = 'theinternetworksltd-careers';
_mag.default_protocol = ('https:' == document.location.protocol ? 'https:' : 'http:');
_mag.startTime = (new Date()).getTime();
(function(d,t) {
<!-- Start of eXelate Tag -->
<script type="text/javascript" src="//loadeu.exelator.com/load/?p=394&c=694395&g=001&ctg=jobs&subctg=finance&count=UK&city=London&career=finance&ed=3rdlevel&gd=male&kw=accounting&zip=11801"></script>
<!-- End of eXelate Tag -->
<!-- Google Code for Remarketing Tag -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 986088887;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<script>
(function(f,b){
var c;
f.hj=f.hj||function(){(f.hj.q=f.hj.q||[]).push(arguments)};
f._hjSettings={hjid:18641, hjsv:3};
c=b.createElement("script");c.async=1;
c.src="//static.hotjar.com/c/hotjar-18641.js?sv=3";
b.getElementsByTagName("head")[0].appendChild(c);
})(window,document);
</script>
<!-- Start Visual Website Optimizer Asynchronous Code -->
<script type='text/javascript'>
var _vwo_code=(function(){
var account_id=126732,
settings_tolerance=2000,
library_tolerance=2500,
use_existing_jquery=false,
// DO NOT EDIT BELOW THIS LINE
f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&r='+Math.random());var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha
<script type="text/javascript">(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
@alex-kirienko
alex-kirienko / README.md
Last active December 20, 2015 12:49 — forked from smileart/README.md

My modified fork of agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

Compatibility