Skip to content

Instantly share code, notes, and snippets.

int a;
...
if(a > 0)
{
//do something
}
int a, b;
...
if(a || b)
{
//do something
}
/* discover context if required */
if(need_token && (!have_token))
{
int ok = discover_context(...);
result = ok ? S_OK : E_FAIL;
goto exit;
}
/* If we don't need to discover the context, but need to do more work, hand to calling code */
if((have_token || !need_token) && ! all_done)
if(a)
{
// do something...
}
if(!a && b)
{
// do something else...
}
if(a)
{
// do something...
}
else if(b)
{
// do something else...
}
#include <stdio.h>
int main(int argc, char *argv[])
{
int a = -1;
unsigned int b = 1;
if (a < b) printf ("OK");
else printf("Whoops!");
return 0;
@SteveGilham
SteveGilham / gist:015734bd2d6084d6cb3f
Created April 14, 2015 20:04
Spawn a process in FePy
import sys
import System
from System.Diagnostics import *
from System.IO import *
#---------------------------------------------------
def spawn(cmd, args, wait=True):
"""Spawn a process running executable 'cmd' with the rest of the command line given by
'args'. If wait is given as False, the rest of the script keeps on going while the sub-process
import sys
# begin added
sys.path.append(r"c:\python25\lib")
# end added
import clr
# Reference the WPF assemblies
import clr
clr.AddReferenceByName("PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
clr.AddReferenceByName("PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
import System.Windows
# Initialization Constants
Window = System.Windows.Window
Application = System.Windows.Application
Button = System.Windows.Controls.Button
from wpf import *
# Create window
my_window = Window()
my_window.Title = 'Welcome to IronPython'
# Create StackPanel to Layout UI elements
my_stack = StackPanel()
my_stack.Margin = Thickness(15)
my_window.Content = my_stack