Skip to content

Instantly share code, notes, and snippets.

@juhasz
juhasz / check-some.js
Created December 28, 2010 23:35
check all and check some of checkboxes with jQuery
var nodes = $("input[name^=node]").map(function(){return this.value;});
for (var i = 0; i < 400; i++) {
$("input[value=" + nodes[i] + "]").attr('checked', 'checked')
};
var nodes = $("input[name^=node]").map(function(){return this.value;}); for (var i = 0; i < 400; i++) { $("input[value=" + nodes[i] + "]").attr('checked', 'checked') };
@juhasz
juhasz / 960gs-full.css
Created December 29, 2010 23:37
Full - a helpel class for 960gs based grid systems
/* =Grid >> Children (Full = Alpha + Omega)
--------------------------------------------------------------------------------*/
.full {margin-left: 0; margin-right: 0;}
/**
* Remove spaceball divs from Flickr photo and all sizes-photo pages
*/
function flickrRemoveSpaceball() {
var spaceball = false;
var parent;
if (document.getElementById("photo-drag-proxy")) { // on photo page
parent = document.getElementById("photo");
<?php
/**
* Unified node edit/add page template suggestion for Drupal 6.x
* Filename: page-node-edit.tpl.php
* Rearrange the $vars['template_files'] array, put
* 'page-node-edit.tpl.php' to the end of array.
*
* (use this snipet in template.php, at the and of
* 'MYTHEME_preprocess_page' function)
*/
@juhasz
juhasz / gist:992715
Created May 26, 2011 07:25
vmrc snippets
" arrow keys move visible lines
inoremap <Down> <C-R>=pumvisible() ? "\<lt>Down>" : "\<lt>C-O>gj"<CR>
inoremap <Up> <C-R>=pumvisible() ? "\<lt>Up>" : "\<lt>C-O>gk"<CR>
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
" toggle between number and relative number on ,l
nnoremap <leader>l :call ToggleRelativeAbsoluteNumber()<CR>
@juhasz
juhasz / gist:1001414
Created May 31, 2011 22:25
find php functions in a tree
# with filenames and linenumbers
grep -e ^function\ .*\( -r -n . | sed s/^.*\\///g | sed s/:function/:/g | sed s/\).*$/\)/g | grep :.*blog_node_view.*\(
# without filenames and linenumbers
grep -e ^function\ .*\( -r -h . | sed s/function\ //g | sed s/\).*$/\)/g | grep blog_node_view.*\( | sort
<?php
/**
* Form for create MailChimp campaign, from node content.
*/
function mailchimp_campaign_create_form($form, &$form_state) {
$node = $form_state['build_info']['args'][0];
$defaults = variable_get('mailchimp_campaign_node_type_settings_' . $node->type, FALSE);
$form['mailchimp_campaign_create'] = array(
'#type' => 'fieldset',
<?php
function SMINKNEVE_preprocess_field(&$variables) {
if ($variables['element']['#field_name'] == 'field_text') {
$variables['classes_array'][] = 'sajat-class';
}
dpm($variables);
}
$items['mailchimp-campaign/%cid/update/%'] = array(
'title' => 'Update',
'page callback' => '_mailchimp_campaign_action_access',
'page arguments' => array(1, 3, 'update'),
'access arguments' => array('send mailchimp campaign'),
'type' => MENU_CALLBACK,
);
set filetype=markdown | set norelativenumber | set laststatus=0 | set columns=84 | set lines=55 | set textwidth=84 | set fuoptions=background:#fffdf6e3 | set nocursorcolumn | set background=light