Skip to content

Instantly share code, notes, and snippets.

View zaki's full-sized avatar

Dezső Zoltán zaki

View GitHub Profile
// Why calling virtual methods in constructors is a bad idea in C# too
// Interestingly VS2010 somehow knows how to use the intializer outside ctor,
// but not the one inside
public class BaseClass
{
public BaseClass()
{
System.Console.WriteLine("BaseClass.ctor");
M1();
}
SyntaxHighlighter.brushes.IL = function()
{
var keywords = '#line .addon .assembly .cctor .class .corflags .ctor .custom .data .emitbyte ' +
'.entrypoint .event .export .field .file .fire .get .hash .imagebase .import ' +
'.language .line .locale .localized .locals .manifestres .maxstack .method ' +
'.module .mresource .namespace .other .override .pack .param .pdirect .permission ' +
'.permissionset .property .publickey .publickeytoken .removeon .set .size ' +
'.subsystem .try .ver .vtable .vtentry .vtfixup .zeroinit abstract add add.ovf ' +
'add.ovf.un algorithm alignment and ansi any arglist array as assembly assert ' +
'at auto autochar beforefieldinit beq beq.s bge bge.s bge.un bge.un.s bgt bgt.s ' +
using System.IO;
using System.Text;
using NAnt.Core;
using NAnt.Core.Attributes;
using System.Security.Cryptography;
namespace NAntKeygen
{
[TaskName("keygen")]
public class KeygenTask : Task
> 2055 tests, 9170 assertions, 34 failures, 1 errors, 0 skips
1) Failure:
test_atomic_write_preserves_default_file_permissions(AtomicWriteTest) [test/core_ext/file_test.rb:54]:
<33206> expected but was
<33188>.
2) Failure:
test_atomic_write_preserves_file_permissions(AtomicWriteTest) [test/core_ext/file_test.rb:33]:
<33261> expected but was
#!/bin/bash
for file in `tree -fi -I "*.tar|*.gz|*.jpg|*.gif|*.png|*.ico" .`
do
if [ -f "$file" ]
then
echo -n $file,
cloc --quiet --no3 --csv $file | awk -F "," '/1,[a-zA-Z]/ {print $2,",",$5}'
fi
done
class Run
def calc(str)
res, cost = 0,0
copy_buffer = 0
str.split(//).each do |c|
if c == '1'
res += 1
cost += 1
elsif c == 'C'
cost += 2
@zaki
zaki / devise.hu.yml
Created November 2, 2010 10:21
Hungarian locale file for devise http://github.com/plataformatec/devise/
en:
errors:
messages:
not_found: "nem található"
already_confirmed: "már meg lett erősítve"
not_locked: "nincs zárolva"
not_saved:
one: "a %{resource} mentését a következő hiba megakadályozta:"
other: "a %{resource} mentését a következő %{count} hiba megakadályozta:"
@zaki
zaki / ruby_lambda_closure.rb
Created March 22, 2011 08:00
Ruby Lambda Closure
x = 1 # Variable defined outside lambda
# 1. lambda closes over outside env, so you can use x if was in scope when
# lambda was defined
lmbd1 = lambda { print x }
lmbd1.call # => 1
# 2.1 the outside var must exist and be in scope when you define lambda
lmbd2_1 = lambda { print u }
u = 1
@zaki
zaki / ti.md
Created June 14, 2011 10:25
Titanium Appcelerator Platform Specific Examples

#iOS:

base_ui

  • Tabs
  • Window NavBar
  • Window Toolbar
  • Window Constructor
  • Animation
  • Nav Group
  • Modal Windows
  • Custom Fonts
@zaki
zaki / custom-syntax.php
Created July 5, 2011 10:06
IL Brush for Wordpress Syntax Highlighter Evolved
<?php
/*
* Plugin Name: SyntaxHighlighter Evolved: Custom Brushes
* Description: Adds support for IL code to the SyntaxHighlighter Evolved plugin.
* Author: Zoltan Dezso
* Version: 1.0.0
* Author URI: http://zaki.asia
* */
add_action( 'init', 'syntaxhighlighter_il_regscript' );