Skip to content

Instantly share code, notes, and snippets.

View bratsun's full-sized avatar

Max Bratsun bratsun

View GitHub Profile
@bratsun
bratsun / kill_process
Created August 5, 2015 10:29
Kills process by PID
ps aux|grep "Coccinellida" // find PID
sudo kill -33605 PID // kill
@bratsun
bratsun / selectboxfix.js
Created July 23, 2015 14:13
Selectbox placeholder fix
// selectbox fix
$('select').change(function(){
checkSelect($(this));
});
function checkSelect(obj){
if (obj[0].selectedIndex <= 0) {
obj.addClass('not-selected').removeClass('selected');
}
@bratsun
bratsun / bootstrap_clearfix.css
Created July 16, 2015 17:21
Bootstrap clearfix
/* Bootstrap Clearfix */
/* Tablet */
@media (min-width:767px){
/* Column clear fix */
.col-lg-1:nth-child(12n+1),
.col-lg-2:nth-child(6n+1),
.col-lg-3:nth-child(4n+1),
.col-lg-4:nth-child(3n+1),
@bratsun
bratsun / webform_columns.css
Created July 14, 2015 09:33
Webform columns
.webform-client-form > div > * {
float: left;
width: 48%;
margin-bottom: 15px;
}
.webform-client-form > div > *:nth-child(even){
margin-left: 4%;
}
@bratsun
bratsun / build_alias_based_on_parent_alias
Created May 22, 2015 21:12
Path alias based on parent page alias
[node:menu-link:parent:url:path]/[node:title]
@bratsun
bratsun / link_with_class.php
Created May 22, 2015 15:40
Link with class
@bratsun
bratsun / reset_field_template.php
Created May 22, 2015 13:53
Reset field template
<?php foreach ($items as $delta => $item): ?>
<?php print render($item); ?>
<?php endforeach; ?>
@bratsun
bratsun / field--field_tabs.js
Created May 22, 2015 13:45
Bootstrap tabs based on nestedbox (Tabs (nb) -> Tab (nb))
// tabs
$('.tabpanel a').click(function (e) {
e.preventDefault()
$(this).tab('show')
});
$('.tabpanel').each(function(){
var t = $(this);
t.find('.nav > li:first, .tab-content > .tab-pane:first').addClass('active');
@bratsun
bratsun / social.css
Created May 20, 2015 15:45
Social buttons
/* social */
.btn-twitter {
background: #00acee;
border-radius: 0;
color: #fff
}
.btn-twitter:link, .btn-twitter:visited {
color: #fff
}
@bratsun
bratsun / youtube_by_id.js
Created May 19, 2015 08:04
Embed, start and control youtube video by ID
// init player, set vars
var player = {
playVideo: function(container, videoId) {
if (typeof(YT) == 'undefined' || typeof(YT.Player) == 'undefined') {
window.onYouTubePlayerAPIReady = function() {
player.loadPlayer(container, videoId);
};
$.getScript('//www.youtube.com/player_api');
} else {