Skip to content

Instantly share code, notes, and snippets.

mecab mecab

Block or report user

Report or block mecab

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mecab
mecab / MainPage.xaml.cs
Created May 27, 2012
Sample code of fixing strange slider behivor with GestureService (code-behind)
View MainPage.xaml.cs
using System.Windows.Input;
using Microsoft.Phone.Controls;
using Microsoft.Xna.Framework.Input.Touch;
namespace SliderWithGestureService {
public partial class MainPage : PhoneApplicationPage {
// Constructor
public MainPage() {
InitializeComponent();
}
@mecab
mecab / MainPage.xaml
Created May 27, 2012
Sample code of fixing strange slider behivor with GestureService
View MainPage.xaml
<phone:PhoneApplicationPage
x:Class="SliderWithGestureService.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tookit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
View cv4.py
import itertools
image = [[10,10,10,10,10,10,10,10,10],
[10,10,10,10,10,10,10,10,10],
[10,10,10,10,10,250,250,250,250],
[10,10,10,10,10,250,250,250,250],
[10,10,250,250,250,250,250,250,250],
[10,10,10,250,250,250,250,250,250],
[10,10,10,10,250,250,250,250,250],
[10,10,10,10,250,250,250,250,250],
View NavigationFixedSearchResultPage.xaml
<common:LayoutAwarePage
x:Name="pageRoot"
x:Class="App1.SearchResultsPage"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:common="using:App1.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@mecab
mecab / mactype.ini
Created Nov 19, 2012
My MacType configuration.
View mactype.ini
[General]
HintingMode=2
AntiAliasMode=1
NormalWeight=8
BoldWeight=0
ItalicSlant=0
EnableKerning=1
GammaMode=0
LcdFilter=1
BolderMode=0
@mecab
mecab / myitertools.py
Last active Dec 11, 2015
A custom iterators for me :D
View myitertools.py
import itertools
import math
def defer(l, num_defer=1):
"""
>>> [x for x in defer([0, 1, 2, 3])]
[[0, 1], [1, 2], [2, 3]]
>>> [x for x in defer([0, 1, 2, 3], 2)]
[[0, 2], [1, 3]]
View my-window-resizer.l
(defun my-window-resizer ()
"Control window size and position."
(interactive)
(let ((window-obj (selected-window))
(current-width (window-width))
(current-height (window-height))
(dx (if (= (nth 0 (window-coordinate)) 0) 1
-1))
(dy (if (= (nth 1 (window-coordinate)) 0) 1
-1))
View dft.py
import cmath
I = 1j
data = [ cmath.sin(cmath.pi * 2 * x / 16.0) + 1 for x in xrange(16)]
def dft_gen(data):
return (_sum_xk(data, j) for j in xrange(len(data)))
View fft.py
import cmath
def fft(data):
data = data[:] # copy data to avoid side effect
N = len(data)
w = calc_coefficients(N)
reorder_data(data)
a = 1
View custom_json_encoder.py
from django.utils import simplejson as json
class SerializeMethod(object):
def __init__(self):
self.type = type_
self.func = func
class CustomJSONEncoder(json.JSONEncoder):
You can’t perform that action at this time.