Skip to content

Instantly share code, notes, and snippets.

View oxyc's full-sized avatar

oxyc

View GitHub Profile

Get off your ass and learn VIM

blabla

Getting started

  • Don't go in to deep
  • Start with an empty vimrc
  • Research!
  • Cheatsheet, write it!

Blog topics

  • My choice of tools
  • Bash magic
  • Dotfiles
  • Learning VIM
  • Git guides are too difficult
  • Vimrc walkthrough, one line at a time
  • Vimscript basics
  • Learn just enough AWK and sed to find them useful
set nocompatible " get out of vi-compatible mode
syntax on
scriptencoding utf-8
filetype plugin indent on
set autoindent
set smartindent
set backup " make backup files
set backupdir=~/.vim/backup " backup directory
@oxyc
oxyc / gist:2140459
Created March 20, 2012 19:45
Snippets from #awk, #sed
20:56:58 < fbsd_> Madonna - MDNA (2012)Categoria: Musica: MP3 Tamanho: 75.82 MB Adicionado: 2012-03-20 16:47:21 Sementes: 2 Utilizadores: 2
21:01:58 < pgas> awk -F'Categoria|Musica|Tamanho|Adicionado|Sementes|Utilidores' '{print $1;print "Categoria" $2;print "Musica" $3; ....}'
@import "variables";
@import "mixins";
/**
* Returns the fraction of a nominator and a denominiator expressed as a
* percentage value. Used to convert pixel values to percentages.
*
* @param $nominator
* The desired width in pixels.
* @param $denominator
27-21-114918JZJ29F05477
57-24-144352JZJ29F05F00
94-28-181020JZJ29F06DAB
35-22-124335TTJ30F082BD
77-10-073558SDC05104310A
73-10-073108ZSC061045834
test
#!/usr/bin/env drush
$terms = array(
27 => 318,
28 => 319,
29 => 320
);
foreach ($terms as $src => $dst) {
$nids = taxonomy_select_nodes($src, FALSE, FALSE);
$i18n_match = i18n_string(array('fastfilter', 'mauste','match', $term->tid), $match, array('langcode' => $node->language));
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.snellman.fi (be patient)
Server Software: Apache
Server Port: 80
<?php
/**
* Implements hook_entity_insert().
*
* We use this hook as it's called later than node_insert().
*/
function HOOK_entity_insert($node, $type) {
module_field_collection_stuff($node, $type);
}