Skip to content

Instantly share code, notes, and snippets.

View berkes's full-sized avatar
🌱
open to work

Bèr Kessels berkes

🌱
open to work
View GitHub Profile
@berkes
berkes / Auto Unfollow people who foursquare
Created July 28, 2010 10:31
Auto Unfollow people who update twitter from foursquare
# Gem by John Nunemaker http://twitter.rubyforge.org/ | http://github.com/jnunemaker/twitter
require 'twitter'
# yea, I know, should be oauth, but hey, this is just a script you run locally. So, whatever.
httpauth = Twitter::HTTPAuth.new('username', 'pasword')
client = Twitter::Base.new(httpauth)
# This selects only twenty last tweets. Play with the query for
# http://rdoc.info/rdoc/jnunemaker/twitter/blob/d2432da5a54fc9b788258ff9adfc93b379624957/Twitter/Base.html#friends_timeline-instance_method to receive more tweets
foursquares = client.friends_timeline.select {|t| t.source =~ /foursquare\.com/ }
@berkes
berkes / Drupal Hook_cron design pattern
Created August 5, 2010 09:11
Drupal Hook_cron design pattern
/**
* Implementation of hook_cron().
*/
function example_cron() {
static $is_running;
$time = time();
//Call is_active. IF so, stor in variable.
if (!$is_running && _example_cron_may_run($time, variable_get('example_alive_last_ran', 0), variable_get('example_refresh_interval', 648000))) {
$is_running = TRUE;
Sep 4 13:36:30 yasmine NetworkManager: <info> Activation (ttyACM0) starting connection 'Vodafone Business 1'
Sep 4 13:36:30 yasmine NetworkManager: <info> (ttyACM0): device state change: 3 -> 4 (reason 0)
Sep 4 13:36:30 yasmine NetworkManager: <info> Activation (ttyACM0) Stage 1 of 5 (Device Prepare) scheduled...
Sep 4 13:36:30 yasmine NetworkManager: <info> Activation (ttyACM0) Stage 1 of 5 (Device Prepare) started...
Sep 4 13:36:30 yasmine NetworkManager: <info> (ttyACM0): device state change: 4 -> 6 (reason 0)
Sep 4 13:36:30 yasmine NetworkManager: <info> Activation (ttyACM0) Stage 1 of 5 (Device Prepare) complete.
Sep 4 13:36:30 yasmine NetworkManager: <info> Activation (ttyACM0) Stage 1 of 5 (Device Prepare) scheduled...
Sep 4 13:36:30 yasmine NetworkManager: <info> Activation (ttyACM0) Stage 1 of 5 (Device Prepare) started...
Sep 4 13:36:30 yasmine NetworkManager: <info> (ttyACM0): device state change: 6 -> 4 (reason 0)
Sep 4 13:36:30 yasmine NetworkManager: <info> Activation (ttyACM
<?php
/*
* menu callback to render the tagadelic title
*
* Args:
* @param $vocs. An array of vocabulary IDs
*/
function tagadelic_page_title_callback((array) $vocs) {
$title = '';
@berkes
berkes / views-view-grid.tpl.php
Created September 30, 2010 22:03
grid style Drupal view, but use 960.gs instead of tables.
<?php
/**
* @file views-view-grid.tpl.php
* Default simple view template to display a rows in a grid.
*
* - $rows contains a nested array of rows. Each row contains an array of
* columns.
*
* @ingroup views_templates
*/
@berkes
berkes / template.php
Created October 26, 2010 09:42
Drupal template helpers to render values.
<?php
/**
* Renders a value cleaned. Simply pulls value through check_plain.
*
* Example usage:
* @code
* r('foo'); //=> "Foo"
* r('<script alert(infected)>Foo'); //=> "Foo"
* r("<em>123</em>"); //=> 123
* @endcode
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
nl:
errors:
messages:
not_found: "niet gevonden"
already_confirmed: "is al geactiveerd"
not_locked: "is niet geblokkeerd"
@berkes
berkes / archivethunder.sh
Created November 24, 2010 11:58
Archive certain IMAP directories with archivemail.
#! /bin/bash
# create archive directories:
archiveroot="$HOME/Archief/mail/"
dir="$archiveroot`date +%Y`/`date +%m`/`date +%d`/"
mkdir -p $dir
# set passwordfile, file should contain nothing but the password.
# You should at least make this file only readable by you.
pwfile=$HOME/Private/archivemailpw
@berkes
berkes / error.out
Created December 13, 2010 16:48
Error factory_girl
/home/ber/.rvm/gems/ruby-1.9.2-p0@rails_sample_app/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require': /home/ber/Documenten/WBR_webschuurrails/sample_app/spec/factories.rb:3: invalid multibyte char (US-ASCII) (SyntaxError)
/home/ber/Documenten/WBR_webschuurrails/sample_app/spec/factories.rb:3: invalid multibyte char (US-ASCII)
/home/ber/Documenten/WBR_webschuurrails/sample_app/spec/factories.rb:3: syntax error, unexpected $end, expecting keyword_end
user.name "Bèr Kessels"
^
from /home/ber/.rvm/gems/ruby-1.9.2-p0@rails_sample_app/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `block in require'
from /home/ber/.rvm/gems/ruby-1.9.2-p0@rails_sample_app/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/ber/.rvm/gems/ruby-1.9.2-p0@rails_sample_app/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/ber/.rvm/gems/r
@berkes
berkes / added_identica_to_diaspora.diff
Created December 21, 2010 12:04
git diff 61b2bbb..HEAD
diff --git a/app/models/service.rb b/app/models/service.rb
index eb0d48a..e0234b0 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -26,3 +26,4 @@ class Service
end
require File.join(Rails.root, 'app/models/services/facebook')
require File.join(Rails.root, 'app/models/services/twitter')
+require File.join(Rails.root, 'app/models/services/identica')
diff --git a/app/models/services/identica.rb b/app/models/services/identica.rb