berkes


Member since 11/27/2006

Name: Bèr Kessels

berkes

Location: Nijmegen, Netherlands

Website: http://webschuur.com

The way of the Hacker - Long term #Drupal developer - owner of webschuur.com - OpenSource lover - Long term #linux user - Rails user

41 snippets

7109 profile views

10 Comment(s) Posted

View their favorites

Profile

Achievement

first submission:submitting first snipplet

berkes's Recent Snippets



« Prev 1 2
Just a funny, yet usefull fixture for testing users in a rails app. Using "somewhat real" fixtures, will keep testing both fun and realistic. Knowing that "Crabbe_ugly_nick" failed, is a lot easier to communicate then knowing "user_t_x01 failed"
0 713 posted 14 years ago by berkes
Put this line in your .bashrc. If the user has a directory named 'bin' then that will be added to the PATH. All scripts in that path (wich are executable) will be available as commands to that user.
0 1130 posted 14 years ago by berkes
Drupal allows hook_update_N to run any sort of code. Most of the time, however, people only use this to alter the database scheme. But you can use it for much more. Like setting variables, creating nodes, importing views and so on. This code show...
2 1014 posted 14 years ago by berkes
By using hook_form_alter, you can add your own callback functions to any Drupal form. These functions will be called when Drupal validates the form and when Drupal submits it. In example below, a module called 'simple_checkout' adds its own hand...
1 802 posted 14 years ago by berkes
Use wget and sed to get your public IP adress (instead of firing up firefox and visting whatismyip.com). Usefull in scripts where you need your public IP adres. There are probably better ways, maybe even a GNUtool that I missed?
0 864 posted 14 years ago by berkes
make a tarball of only the changed directories in a git repos, since last tag. replace {tagname_last} with any name you siwh to give the tarball replace {tagname_previous} with a git reference (like a tag) from which you want to zip the changes.
0 994 posted 14 years ago by berkes
Wizzlern, a Dutch Drupal trainer, has a Dutch article online on how to remove the "search this site" label in the Drupal search-block.
2 924 posted 14 years ago by berkes
Instead of ~/.ssh/id_rsa.pub, you can choose any location on your local machine where your *public* key lives. You may need to adjust the file permissions on remote authorized_keys aftwterwards, depending on the configuration of the remote ssh serve...
0 974 posted 14 years ago by berkes
This script pulls in files with [rsync](http://samba.anu.edu.au/rsync/), storing them locally with hardlinks for unchanged, and real files for changed -files. * KEY=$HOME/.ssh/id_dsa_passwdless -- an id_rtsa key without a password. --adding this t...
0 778 posted 14 years ago by berkes
http://pcextreme.nl is one of the Best hosters for Drupal in Netherlands. But they require one change to the .htaccess in order to run.
0 656 posted 14 years ago by berkes
1 738 posted 14 years ago by berkes
I had several vocabularies but wanted to merge them into one. A simple query does this for you. The vocabulary_id where I wanted to merge all the tags into is 3 The vocabulary_id where the tags are to be merged from is 7, 8 and 12
2 789 posted 14 years ago by berkes
Change 'username' (twice!) with your imap username,'password'with your imap password, and 'example.com' (twice!) with the url of your imap mailserver. Works on: Ubuntu with Evolution, sqlite3 and archivemail installed. Evolution is required beca...
1 965 posted 14 years ago by berkes
Takes a .sql file and runs trough that, each line as an update_sql. Very usefull to track and migrate your blocks/views/cck etc changes.
0 822 posted 15 years ago by berkes
A common Drupal problem: how to save e.g. your blocks configuration without dragging an X Gig database around. A simple command that dumps a table in a way that it can be inserted into SVN. Every row is dumped as a single line, and they are sor...
1 742 posted 15 years ago by berkes
Grab http://blog.kissmetrics.com/common/images/required.png as example for a required image . NOTE: You probably don't want to use this trcik, but rather go for the defacto standard of a red asterisk to mark something required. An asterisk is lang...
1 785 posted 15 years ago by berkes
A bash script that calls Drush for all your multisite sites and returns a list of available and installed modules for each site.
2 859 posted 16 years ago by berkes
Drupal helper function to debug a table. Returns the contents and some explanation of a database table in a rendered format (HTML table). **NOTE** You REALLY do not want to put this function behind any kind of menu_callback and/or on other pages....
1 1251 posted 16 years ago by berkes
A per-region override. ogt_blocks is ran for a region, if a region contains blocks, we search for a theme function named theme_region_regionname(). If exists, we run that, else we just return the concatenated blocks for that region.
1 921 posted 16 years ago by berkes
An easy debug trick: gives you a variable that you can print in any tpl.php to find out what vars you have available there.
1 955 posted 16 years ago by berkes
This script removes (DROPS) all tables that start with foo_. Usefull if you had some CMS or application that (ab)uses table prefixing, and want to clean 0ut your database. NOTE: the data is remove FOREVER! So take good casre: make backups and all...
2 1016 posted 16 years ago by berkes
Place the first function, phptemplate_links() in your template.php file. Alternatively (and IMO better) is to name the function your_theme_name_links() where your_theme_name is the name of your theme. From here on, you can add theme functions like...
2 927 posted 16 years ago by berkes
Sets a module's weight to the lowest number. This assures that your module is ran before all other modules. Userfull if you want your implementation of a hook to be ran first. Add this to your .install file. Replace your_modulename with the name of...
2 770 posted 16 years ago by berkes
Add these lines to Drupals settings.php. Probably works on other systems, then Drupal too.
1 989 posted 16 years ago by berkes
Removes the core, and node styles from the $style variable. You most morbably already defined _phptemplate_variables($hook, $vars), in that case just add the two lines there. _sympal_theme.. is the name of the theme where we use this.
3 888 posted 17 years ago by berkes
Shortens a string, and adds a span with a title of the full string. Function is useful for listings where you don't want wraping; or for places where a long string liek a username can break the layout.
1 913 posted 17 years ago by berkes
This snipped adds columnstriping to cells. It works fine for most cases, but will behave strange when combined with colspan. Cells get an additional class 'even-col' or 'odd-col'
2 975 posted 17 years ago by berkes
« Prev 1 2