Skip to content

Instantly share code, notes, and snippets.

View preslavrachev's full-sized avatar

Preslav Rachev preslavrachev

View GitHub Profile
<UserControl x:Class="MVVMSimpleDemo.View.QuestionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:MVVMSimpleDemo.ViewModel"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<UserControl.Resources>
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
<?php
$index = getIndex();
// print_r($index);
printf ("%33s\n", "----- Raw matrix -----");
printMatrix($index);
normalize($index);
newline(3);
printf ("%40s\n", "----- Normalized matrix -----");
printMatrix($index);
@preslavrachev
preslavrachev / gist:811369
Created February 4, 2011 17:01
Self Executing Anonymous Function
(function() {
doSomething();
})()
// or ...
//NOTE: This is basically doing the same thing, but we can gain a tiny bit performance, because we directly
package {
import flash.display.MovieClip;
public class SuperNode extends MovieClip
{
public var mainShape:MovieClip;
public function SuperNode()
{
super();
require "open-uri"
require "rubygems"
require "json"
USERNAME = "henrik"
query = ARGV.first.downcase
gists = JSON.parse(open("http://gist.github.com/api/v1/json/gists/#{USERNAME}").read)['gists']
@preslavrachev
preslavrachev / GistManager.cs
Created February 24, 2011 09:15
A simple console utility for browsing and searching Github's Gist ... not fully finished, due to limitations in the API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using System.Net;
using System.IO;
namespace gist
{
File file = new File("C:\\Users\\preslav\\DEsktop\\temp.jpg");
byte[] bytes = new byte[file.length()];
InputStream is = new FileInputStream(file);
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0)
{
offset += numRead;
Clazz = function(num) {
var priv = num;
this.pub = priv;
that = this;
}
Clazz.prototype.outsider = function() {
return priv;
}
photoView: SC.GridView.design({
actOnSelect: YES,
isEnabled: YES,
actionBinding: 'Instagram.navigationController.showPhotoDetailsPage',
layout: { centerX: 0, centerY: 100, width: 900, height: 300 },
columnWidth: 200,
rowHeight: 200,