Skip to content

Instantly share code, notes, and snippets.

View nikosd's full-sized avatar

Nikos Dimitrakopoulos nikosd

View GitHub Profile
#!/usr/bin/ruby
require 'rubygems'
require 'gruff'
# Simplest graph
g = Gruff::Bar.new
g.title = 'A simple bar chart'
#!/usr/bin/ruby
require 'rubygems'
require 'gruff'
# With more options now
g = Gruff::Bar.new('800x500') # Define a custom size
g.sort = false # Do NOT sort data based on values
g.maximum_value = 50 # Declare a max value for the Y axis
#!/usr/bin/ruby
require 'rubygems'
require 'gruff'
# Let's hack almost everything
g = Gruff::Bar.new('800x700') # Define a custom size
g.sort = false # Do NOT sort data based on values
g.maximum_value = 40 # Declare a max value for the Y axis
<div id="container">
<h1><a href="#">Some fancy title</a></h1>
</div>
// Using jQuery Events and Selectors
$(document).ready(function(){
var original_content = $('div#container h1 a').html();
var with_fake_first_letter = '<span class="first-letter">'
+ original_content.slice(0,1)
+ '</span>'
+ original_content.slice(1,original_content.length - 1);
$('div#container h1 a').html(with_fake_first_letter);
});
sIFR.replace(paris_aifel, {
selector: 'h1'
,css: [
'.sIFR-root { text-align: center; font-weight: bold; }'
,'a { text-decoration: none; }'
,'a:link { color: #660000; }'
,'a:hover { color: #993333; }'
,'.first-letter { font-style: normal; color: #000000; }' /* This is the important part */
]
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>sIFR pseudo class</title>
<link rel="stylesheet" href="all.css" type="text/css" media="all">
<link rel="stylesheet" href="css/sifr.css" type="text/css">
@nikosd
nikosd / el-GR.yml
Created November 10, 2008 23:36
Localization file for Globalite Rails Plugin (Greek Language)
locale_name: "Ελληνικά (Ελλάδα)"
# ActiveRecord::Errors.default_error_messages
error_message_inclusion: "δεν συμπεριλαμβάνεται στην λίστα"
error_message_exclusion: "είναι δεσμευμένο"
error_message_invalid: "δεν είναι έγκυρο"
error_message_confirmation: "δεν ταιριάζει με την επαλήθευση"
error_message_accepted: "πρέπει να γίνει αποδεκτό"
error_message_empty: "δε μπορεί να είναι άδειο"
error_message_blank: "δε μπορεί να είναι κενό"
error_message_too_long: "είναι πολύ μεγάλο (ο μέγιστος αριθμός χαρακτήρων είναι %d )"
require 'rubygems'
require 'activesupport'
$KCODE = 'u'
class String
# Converts the Greek Unicode characters contained in the string
# to latin ones (aka greeklish) and returns self.
# For unobstructive conversion call the non-bang method 'greeklish'
#
# example:
@nikosd
nikosd / database.js
Created January 18, 2009 11:08
Some sample code from my thesis about creating offline web applications (http://nikosd.com/work.html). iris.js is partially the "core" of the app and database.js is a simple object mapping of the database.
var DB = {
init: function(){
dojox.sql("CREATE TABLE IF NOT EXISTS received_messages ("
+ "id INTEGER PRIMARY KEY, "
+ "title TEXT NOT NULL, "
+ "content TEXT, "
+ "sender_name TEXT NOT NULL, "
+ "sender_id TEXT NOT NULL) ");
dojox.sql("CREATE TABLE IF NOT EXISTS local_draft_messages ("