Skip to content

Instantly share code, notes, and snippets.

@Tak
Tak / gist:1578933
Created January 8, 2012 16:42
Refactor: Remove pasted code
diff -r 1150327c24d7 hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py Sun Jan 08 17:09:01 2012 +0100
+++ b/hgext/largefiles/lfcommands.py Sun Jan 08 17:41:58 2012 +0100
@@ -117,22 +117,10 @@
def _addchangeset(ui, rsrc, rdst, ctx, revmap):
# Convert src parents to dst parents
- parents = []
- for p in ctx.parents():
- parents.append(revmap[p.node()])
public static bool IsManagedAssembly (string file)
{
try {
using (Stream fs = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
BinaryReader reader = new BinaryReader(fs);
//The 4-byte PE Header indicator is at 0x3C
fs.Position = 0x3C;
uint peHeader = reader.ReadUInt32();
// This path can be reentered if something else tries to close the window
// before the user responds to the "Save changes?" dialog.
// This results in a stack of "Save changes?" dialogs, and unpredictable behavior
// when responding to all but the first.
// The Right Fix would be to make it impossible for this to happen.
// For now, we work around by replacing the OnClosing handler
// until we get an answer back from the user.
using System;
using System.Collections.Generic;
namespace Sort
{
class MainClass
{
public static void Main (string[] args)
{
var list = new List<int> () {
@Tak
Tak / stl_tree.h
Created September 18, 2012 07:47
// RB tree implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
#!/bin/sh
arch=`uname -i`
case $arch in
x86_64)
echo '64bit!'
;;
i*86)
echo '32bit!'
static function TestFunction(context : String)
{
Debug.Log("static function TestFunction I " + context);
yield 0;
Debug.Log("static function TestFunction II " + context);
}
using System;
using UnityEngine;
public class ScopedHorizontalLayout: IDisposable
{
public ScopedHorizontalLayout (params GUILayoutOption[] options)
{
GUILayout.BeginHorizontal (options);
}
import UnityEngine
class Notebook (MonoBehaviour):
selectedTab = 0
tabs = ("First", "Second");
panels = (DrawFirst, DrawSecond)
def OnGUI ():
selectedTab = GUILayout.Toolbar (selectedTab, tabs)
panels[selectedTab]()
Linux:
linux-vdso.so.1 => (0x00007fff1ffff000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f68b8647000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f68b7d0e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f68b794f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f68b9359000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f68b8429000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f68b8221000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f68b7f25000)