text:
package net.jahhan.init.module;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.guice.annotation.EnableGuiceModules;

import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import com.google.inject.name.Names;

import lombok.extern.slf4j.Slf4j;
import net.jahhan.com.alibaba.dubbo.common.compiler.support.JavassistCompiler;
import net.jahhan.common.extension.annotation.Extension;
import net.jahhan.common.extension.annotation.SPI;
import net.jahhan.common.extension.api.Wrapper;
import net.jahhan.common.extension.utils.ClassScaner;
import net.jahhan.common.extension.utils.ExtensionUtil;
import net.jahhan.common.extension.utils.LogUtil;
import net.jahhan.common.extension.utils.PackageUtil;
import net.jahhan.common.extension.utils.PropertiesUtil;
import net.jahhan.init.InitAnnocation;

@Slf4j
@InitAnnocation(isLazy = false, initSequence = 4500)
@EnableGuiceModules
public class ExtensionInitModule extends AbstractModule {

	private Map<Class<?>, Set<Class<?>>> cachedWrapperClasses = new ConcurrentHashMap<>();
	protected net.jahhan.com.alibaba.dubbo.common.compiler.Compiler compiler = new JavassistCompiler();
	public static boolean needRun = true;

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	protected void configure() {
		if (needRun) {
			String[] packages = PackageUtil.packages("extension");
			List<String> classNameList = new ClassScaner().parse(packages);
			ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
			Properties properties = PropertiesUtil.getProperties("extensionInit");
			Map<Class, List<Class>> unSetMap = new HashMap<>();
			List<Class> settedList = new ArrayList<>();
			// wapper
			for (String className : classNameList) {
				try {
					Class<?> clazz = classLoader.loadClass(className);
					Class interfaceClass = getSuperInterfaceByAnnotation(clazz, SPI.class);
					if (null == interfaceClass) {
						continue;
					}
					if (Wrapper.class.isAssignableFrom(clazz)) {
						Set<Class<?>> wrappers = cachedWrapperClasses.get(interfaceClass);
						if (wrappers == null) {
							wrappers = new HashSet<Class<?>>();
							cachedWrapperClasses.put(interfaceClass, wrappers);
						}
						wrappers.add(clazz);
					}
				} catch (Exception e) {
					log.error(e.getMessage(), e);
				}
			}
			for (String className : classNameList) {
				try {
					Class<?> clazz = classLoader.loadClass(className);
					Class interfaceClass = getSuperInterfaceByAnnotation(clazz, SPI.class);
					if (null == interfaceClass) {
						continue;
					}

					if (clazz.isAnnotationPresent(Extension.class)) {
						Extension extension = clazz.getAnnotation(Extension.class);
						String extensionValue = extension.value();
						Set<Class<?>> set = cachedWrapperClasses.get(interfaceClass);
						if (null != set && set.contains(clazz)) {
							continue;
						}

						// 默认配置
						String defaultPlugin = properties.getProperty(interfaceClass.getName());

						if (extensionValue.equals(defaultPlugin)) {
							Class<?> createExtension = createExtension(interfaceClass, clazz);
							if (null != set && set.size() > 0) {
								log.debug("bind {} to {}", interfaceClass.getName(), createExtension.getName());
								log.debug("bind {} named {} to {}", interfaceClass.getName(), extensionValue,
										createExtension.getName());
								bind(interfaceClass).toInstance(createExtension);
								bind(interfaceClass).annotatedWith(Names.named(extensionValue))
										.toInstance(createExtension);
							} else {
								log.debug("bind {} to {}", interfaceClass.getName(), createExtension.getName());
								log.debug("bind {} named {} to {}", interfaceClass.getName(), extensionValue,
										createExtension.getName());
								bind(interfaceClass).to(createExtension).in(Scopes.SINGLETON);
								bind(interfaceClass).annotatedWith(Names.named(extensionValue)).to(createExtension)
										.in(Scopes.SINGLETON);
							}
							settedList.add(interfaceClass);
						} else {// !extension.value().equals(defaultPlugin)
							Class<?> createExtension = createExtension(interfaceClass, clazz);
							if (null != set && set.size() > 0) {
								log.debug("bind {} to {}", interfaceClass.getName(), createExtension.getName());
								bind(interfaceClass).to(createExtension).in(Scopes.SINGLETON);
							} else {
								log.debug("bind {} to {}", interfaceClass.getName(), createExtension.getName());
								bind(interfaceClass).annotatedWith(Names.named(extensionValue)).to(createExtension)
										.in(Scopes.SINGLETON);
							}
							List<Class> list = unSetMap.get(interfaceClass);
							if (null == list) {
								list = new ArrayList<>();
								list.add(clazz);
								unSetMap.put(interfaceClass, list);
							} else {// !null == list
								list.add(clazz);
							}
						}
					}
				} catch (Exception e) {
					log.error(e.getMessage(), e);
				}
			}
			Iterator<Class> iterator = unSetMap.keySet().iterator();
			while (iterator.hasNext()) {
				Class next = iterator.next();
				if (settedList.contains(next)) {
					continue;
				}
				Class<?> createExtension = createExtension(next, unSetMap.get(next).get(0));
				log.debug("bind {} to {}", next.getName(), createExtension.getName());
				bind(next).to(createExtension).in(Scopes.SINGLETON);
			}
		}
	}

	@SuppressWarnings("unchecked")
	private <T> Class<?> createExtension(Class<T> intefaceClass, Class<? extends T> defaultClass) {
		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		Map<Class<?>, Map<Class<?>, String>> extensionCacheClassNameMap = ExtensionUtil.getExtensionCacheClassNameMap();
		try {
			Set<Class<?>> set = cachedWrapperClasses.get(intefaceClass);
			if (null != set && set.size() > 0) {
				Map<Class<?>, String> map = extensionCacheClassNameMap.get(intefaceClass);
				String nextExtName = map.get(defaultClass);
				Class<? extends T> compile = defaultClass;
				for (Class<?> wrapperClass : set) {
					String extName = map.get(wrapperClass);
					extName = extName + "$wrapper$" + nextExtName;
					String createWrapperExtensionClassCode = createWrapperExtensionClassCode(intefaceClass, extName,
							nextExtName);
					compile = (Class<? extends T>) compiler.compile(createWrapperExtensionClassCode, classLoader);
					if (log.isDebugEnabled()) {
						log.debug("bind " + intefaceClass + " named $" + extName + " to " + wrapperClass.getName());
					}
					bind(intefaceClass).annotatedWith(Names.named("$" + extName)).to((Class<? extends T>) wrapperClass)
							.in(Scopes.SINGLETON);
					nextExtName = extName;
					if (log.isDebugEnabled()) {
						log.debug(
								"bind " + intefaceClass + " named wrapper$" + nextExtName + " to " + compile.getName());
					}
					bind(intefaceClass).annotatedWith(Names.named("wrapper$" + nextExtName)).to(compile)
							.in(Scopes.SINGLETON);

				}
				if (null != compile) {
					bind(intefaceClass).annotatedWith(Names.named("$" + map.get(defaultClass))).to(defaultClass)
							.in(Scopes.SINGLETON);
					return compile;
				}

			} else {
				return defaultClass;
			}
		} catch (Exception e) {
			LogUtil.error(e.getMessage(), e);
		}
		return defaultClass;
	}

	private String createWrapperExtensionClassCode(Class<?> type, String extName, String nextExtName) {
		StringBuilder codeBuidler = new StringBuilder();
		Method[] methods = type.getMethods();
		codeBuidler.append("// dubbo extension code:");
		codeBuidler.append(type.getName());
		codeBuidler.append("\npackage " + type.getPackage().getName() + ";");
		codeBuidler.append("\nimport " + ExtensionUtil.class.getName() + ";");
		codeBuidler.append("\nimport javax.inject.Singleton;");
		codeBuidler.append("\n");
		codeBuidler.append("\n@Singleton");
		codeBuidler.append("\npublic class " + type.getSimpleName() + "$Wrapper$" + extName + " implements "
				+ type.getCanonicalName() + " {");
		codeBuidler.append("\nprivate " + type.getName() + " extension = null;");
		codeBuidler.append("\nprivate final String extName = \"" + extName + "\";");
		codeBuidler.append("\npublic " + type.getSimpleName() + "$Wrapper$" + extName + "(){");
		StringBuilder code = new StringBuilder(512);
		code.append("\nString extensionName=extName;");
		code.append(String.format("\n extension = (%s)%s.getExtensionDirect(%s.class,extName);", type.getName(),
				ExtensionUtil.class.getSimpleName(), type.getName()));
		code.append("\nif(extName.contains(\"wrapper\\$\")){");

		code.append("\n" + Wrapper.class.getName() + " wrapper = (" + Wrapper.class.getName() + ") extension;");
		code.append("\nextensionName = extName.substring(extName.indexOf(\"wrapper\\$\")+8);");
		code.append("\nwrapper.setExtName(extensionName);");
		code.append(String.format("\nwrapper.setIntefaceClass(%s.class);", type.getName()));
		code.append("\nwrapper.initExtension();");
		code.append("\n}");
		code.append("\n}");

		codeBuidler.append(code);
		codeBuidler.append("\n}");

		for (Method method : methods) {
			Class<?> rt = method.getReturnType();
			Class<?>[] pts = method.getParameterTypes();
			Class<?>[] ets = method.getExceptionTypes();

			StringBuilder code2 = new StringBuilder(512);
			if (!rt.equals(void.class)) {
				code2.append("\nreturn ");
			}

			String s = String.format("extension.%s(", method.getName());
			code2.append(s);
			for (int i = 0; i < pts.length; i++) {
				if (i != 0)
					code2.append(", ");
				code2.append("arg").append(i);
			}
			code2.append(");");
			codeBuidler.append("\npublic " + rt.getCanonicalName() + " " + method.getName() + "(");
			for (int i = 0; i < pts.length; i++) {
				if (i > 0) {
					codeBuidler.append(", ");
				}
				codeBuidler.append(pts[i].getCanonicalName());
				codeBuidler.append(" ");
				codeBuidler.append("arg" + i);
			}
			codeBuidler.append(")");
			if (ets.length > 0) {
				codeBuidler.append(" throws ");
				for (int i = 0; i < ets.length; i++) {
					if (i > 0) {
						codeBuidler.append(", ");
					}
					codeBuidler.append(ets[0].getName());
				}
			}
			codeBuidler.append(" {");
			codeBuidler.append(code2.toString());
			codeBuidler.append("\n}");
		}
		codeBuidler.append("\n}");
		log.debug(codeBuidler.toString());
		return codeBuidler.toString();
	}

	public static Class<?> getSuperInterfaceByAnnotation(Class<?> type, Class<? extends Annotation> annotation) {
		List<Class<?>> superClasses = new ArrayList<>();
		superClasses.add(type);
		Class<?> superclass = type;
		while ((superclass = superclass.getSuperclass()) != null) {
			superClasses.add(superclass);
		}
		for (Class<?> superclazz : superClasses) {
			Class<?>[] interfaces = superclazz.getInterfaces();
			if (interfaces.length > 0) {
				for (Class<?> interfaceClass : interfaces) {
					if (interfaceClass.isAnnotationPresent(annotation)) {
						return interfaceClass;
					}
				}
			}
		}
		return null;
	}
}


text:
ActiveRecord::Schema.define(version: 20140808083253) do

  create_table "belfiles", force: true do |t|
    t.string   "title"
    t.text     "description"
    t.string   "belfile_path"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "edges", force: true do |t|
    t.string   "relation"
    t.integer  "source_id"
    t.integer  "target_id"
    t.integer  "graph_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "edges", ["graph_id"], name: "index_edges_on_graph_id", using: :btree
  add_index "edges", ["source_id"], name: "index_edges_on_source_id", using: :btree
  add_index "edges", ["target_id"], name: "index_edges_on_target_id", using: :btree

  create_table "graphs", force: true do |t|
    t.string   "label"
    t.boolean  "directed"
    t.integer  "belfile_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "graphs", ["belfile_id"], name: "index_graphs_on_belfile_id", using: :btree

  create_table "nodes", force: true do |t|
    t.string   "label"
    t.string   "fx"
    t.integer  "graph_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "nodes", ["graph_id"], name: "index_nodes_on_graph_id", using: :btree
  add_index "nodes", ["label"], name: "index_nodes_on_label", using: :btree

end

redpajama_set_name: RedPajamaGithub


text:
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnCodecFactory.h"
#include "XnIntProperty.h"
#include <XnFormats/XnUncompressedCodec.h>
#include <XnFormats/Xn16zCodec.h>
#include <XnFormats/Xn16zEmbTablesCodec.h>
#include <XnFormats/Xn8zCodec.h>
#include <XnFormats/XnJpegCodec.h>
#include <XnLog.h>

//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------
XnStatus XnCodecFactory::Create(XnCompressionFormats nFormat, XnDeviceModule* pStream, const XnChar* /*StreamName*/, XnCodec** ppCodec)
{
	XnStatus nRetVal = XN_STATUS_OK;
	XnCodec* pCodec = NULL;

	switch (nFormat)
	{
	case XN_COMPRESSION_NONE:
		{
			XN_VALIDATE_NEW_AND_INIT(pCodec, XnUncompressedCodec);
		}
		break;
	case XN_COMPRESSION_16Z:
		{
			XN_VALIDATE_NEW_AND_INIT(pCodec, Xn16zCodec);
		}
		break;
	case XN_COMPRESSION_16Z_EMB_TABLE:
		{
			// first we need to find max depth
			XnUInt64 nMaxDepth;

			nRetVal = pStream->GetProperty(XN_STREAM_PROPERTY_MAX_DEPTH, &nMaxDepth);
			XN_IS_STATUS_OK(nRetVal);

			XN_VALIDATE_NEW_AND_INIT(pCodec, Xn16zEmbTablesCodec, (XnDepthPixel)nMaxDepth);
		}
		break;
	case XN_COMPRESSION_COLOR_8Z:
		{
			XN_VALIDATE_NEW_AND_INIT(pCodec, Xn8zCodec);
		}
		break;
	case XN_COMPRESSION_JPEG:
		{
			// check what is the output format
			XnUInt64 nOutputFormat;
			nRetVal = pStream->GetProperty(XN_STREAM_PROPERTY_OUTPUT_FORMAT, &nOutputFormat);
			XN_IS_STATUS_OK(nRetVal);

			XnBool bRGB = FALSE;

			switch (nOutputFormat)
			{
			case XN_OUTPUT_FORMAT_GRAYSCALE8:
				bRGB = FALSE;
				break;
			case XN_OUTPUT_FORMAT_RGB24:
				bRGB = TRUE;
				break;
			default:
				XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Codec factory currently supports JPEG codec only for streams of type Gray8 or RGB24!");
			}

			// take X and Y res
			XnUInt64 nXRes, nYRes;
			nRetVal = pStream->GetProperty(XN_STREAM_PROPERTY_X_RES, &nXRes);
			XN_IS_STATUS_OK(nRetVal);

			nRetVal = pStream->GetProperty(XN_STREAM_PROPERTY_Y_RES, &nYRes);
			XN_IS_STATUS_OK(nRetVal);

			XN_VALIDATE_NEW_AND_INIT(pCodec, XnJpegCodec, bRGB, (XnUInt32)nXRes, (XnUInt32)nYRes);
		}
		break;
	default:
		XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Codec factory does not support compression type %d", nFormat);
	}

	*ppCodec = pCodec;
	return (XN_STATUS_OK);
}

void XnCodecFactory::Destroy(XnCodec* pCodec)
{
	XN_DELETE(pCodec);
}


text:
//
//  BackGesture.m
//  TestD
//
//  Created by admin on 15/6/10.
//  Copyright (c) 2015年 Pandora. All rights reserved.
//

#import "UIViewController+BackGesture.h"

@implementation UIViewController (BackGesture)

- (void)addBackGesture
{
    if(self.navigationController != nil && self.navigationController.viewControllers.count > 1){
        UIGestureRecognizer *gesture = self.navigationController.interactivePopGestureRecognizer;
        gesture.enabled = NO;
        UIView *gestureView = gesture.view;
        /**
         *  获取系统手势的target数组
         */
        NSMutableArray *_targets = [gesture valueForKey:@"_targets"];
        /**
         *  获取它的唯一对象,我们知道它是一个叫UIGestureRecognizerTarget的私有类,它有一个属性叫_target
         */
        id gestureRecognizerTarget = [_targets firstObject];
        /**
         *  获取_target:_UINavigationInteractiveTransition,它有一个方法叫handleNavigationTransition:
         */
        id navigationInteractiveTransition = [gestureRecognizerTarget valueForKey:@"_target"];
        /**
         *  通过前面的打印,我们从控制台获取出来它的方法签名。
         */
        SEL handleTransition = NSSelectorFromString(@"handleNavigationTransition:");
        /**
         *  创建一个与系统一模一样的手势,我们只把它的类改为UIPanGestureRecognizer
         */
        UIPanGestureRecognizer *popRecognizer = [[UIPanGestureRecognizer alloc] init];
        [gestureView addGestureRecognizer:popRecognizer];
        [popRecognizer addTarget:navigationInteractiveTransition action:handleTransition];
    }
}

@end


text:
/*
 *  Test the value coercion steps of E5.1 Section, Str() algorithm:
 *
 *    - toJSON (step 2)
 *    - replacer (step 3)
 *    - coercion of Number, String, Boolean objects to primitive values (step 4)
 *    - final Number coercion (step 9)
 *    - special handling for callable objects (step 10)
 */

/*===
replacer called: this=[object Object], key=, val=[object Object]
toJSON called: this=[object Object], key=number_object
replacer called: this=[object Object], key=number_object, val=tojson-retval-1
Number.prototype.valueOf() called, typeof this=object
toJSON called: this=[object Object], key=string_object
replacer called: this=[object Object], key=string_object, val=tojson-retval-2
String.prototype.toString() called, typeof this=object
toJSON called: this=[object Object], key=boolean_object
replacer called: this=[object Object], key=boolean_object, val=tojson-retval-3
{"number_object":321,"string_object":"mystr-tostring","boolean_object":true}
===*/

/* Basic test which covers all steps. */

function valueCoercionTest1() {
    var old_Number_toString;
    var old_Number_valueOf;
    var old_String_toString;
    var old_String_valueOf;
    var old_Boolean_toString;
    var old_Boolean_valueOf;

    var obj = {
        number_object: {
            toJSON: function(k) {
                print('toJSON called: this=' + this + ', key=' + k);
                return 'tojson-retval-1';
            }
        },
        string_object: {
            toJSON: function(k) {
                print('toJSON called: this=' + this + ', key=' + k);
                return 'tojson-retval-2';
            }
        },
        boolean_object: {
            toJSON: function(k) {
                print('toJSON called: this=' + this + ', key=' + k);
                return 'tojson-retval-3';
            }
        }
    };

    function replacer(k,v) {
        print('replacer called: this=' + this + ', key=' + k + ', val=' + v);
        if (v === 'tojson-retval-1') {
            return new Number(123);
        } else if (v === 'tojson-retval-2') {
            return new String('foo');
        } else if (v === 'tojson-retval-3') {
            return new Boolean(true);
        } else {
            return v;
        }
    }

    old_Number_toString = Number.prototype.toString;
    old_Number_valueOf = Number.prototype.valueOf;
    old_String_toString = String.prototype.toString;
    old_String_valueOf = String.prototype.valueOf;
    old_Boolean_toString = Boolean.prototype.toString;
    old_Boolean_valueOf = Boolean.prototype.valueOf;

    // Careful to avoid recursion in print() calls

    Number.prototype.toString = function () {
        print('Number.prototype.toString() called, typeof this=' + typeof this);
        return '432';
    };
    Number.prototype.valueOf = function () {
        print('Number.prototype.valueOf() called, typeof this=' + typeof this);
        return 321;
    };
    String.prototype.toString = function () {
        print('String.prototype.toString() called, typeof this=' + typeof this);
        return 'mystr-tostring';
    };
    String.prototype.valueOf = function () {
        print('String.prototype.valueOf() called, typeof this=' + typeof this);
        return 'mystr-valueof';
    };
    Boolean.prototype.toString = function () {
        print('Boolean.prototype.toString() called, typeof this=' + typeof this);
        return "'tis true";
    };
    Boolean.prototype.valueOf = function () {
        print('Boolean.prototype.valueOf() called, typeof this=' + typeof this);
        return false;
    };

    /*
     * Number object:
     *
     * toJSON() -> 'tojson-retval-2'
     * replacer -> new Number(123)
     * ToNumber() -> Number.prototype.valueOf() -> 321
     * ToString() -> primitive number conversion -> '321'  (Number.ptototype.toString() not called)
     *
     * String object:
     *
     * toJSON() -> 'tojson-retval-2'
     * replacer -> new String('foo')
     * ToString() -> 'mystr-tostring'
     *
     * Boolean object:
     *
     * toJSON() -> 'tojson-retval-3'
     * replacer -> new Boolean(true)
     * Str() accesses Boolean [[PrimitiveValue]] directly, no valueOf()/toString() calls
     */

    try {
        print(JSON.stringify(obj, replacer));
    } finally {
        Number.prototype.toString = old_Number_toString;
        Number.prototype.valueOf = old_Number_valueOf;
        String.prototype.toString = old_String_toString;
        String.prototype.valueOf = old_String_valueOf;
        Boolean.prototype.toString = old_Boolean_toString;
        Boolean.prototype.valueOf = old_Boolean_valueOf;
    }
}

try {
    valueCoercionTest1();
} catch (e) {
    print(e.name, e, e.stack || e);
}

/*===
===*/

/* XXX: replacer/toJSON returns an object with toJSON() */


text:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="FieldValidator Test Suite">
    <test name="Validation">
        <packages>
            <package name="com.github.ahant.validator.validation.*" />
        </packages>
    </test>
</suite>


text:
package armeducation

import (
	"encoding/json"
	"fmt"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"reflect"
)

// MarshalJSON implements the json.Marshaller interface for type Amount.
func (a Amount) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "currency", a.Currency)
	populate(objectMap, "value", a.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Amount.
func (a *Amount) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", a, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "currency":
			err = unpopulate(val, "Currency", &a.Currency)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &a.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", a, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ErrorResponse.
func (e ErrorResponse) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "code", e.Code)
	populate(objectMap, "message", e.Message)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.
func (e *ErrorResponse) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", e, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "code":
			err = unpopulate(val, "Code", &e.Code)
			delete(rawMsg, key)
		case "message":
			err = unpopulate(val, "Message", &e.Message)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", e, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody.
func (e ErrorResponseBody) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "error", e.Error)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody.
func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", e, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "error":
			err = unpopulate(val, "Error", &e.Error)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", e, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type GrantDetailProperties.
func (g GrantDetailProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "allocatedBudget", g.AllocatedBudget)
	populateTimeRFC3339(objectMap, "effectiveDate", g.EffectiveDate)
	populateTimeRFC3339(objectMap, "expirationDate", g.ExpirationDate)
	populate(objectMap, "offerCap", g.OfferCap)
	populate(objectMap, "offerType", g.OfferType)
	populate(objectMap, "status", g.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type GrantDetailProperties.
func (g *GrantDetailProperties) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", g, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "allocatedBudget":
			err = unpopulate(val, "AllocatedBudget", &g.AllocatedBudget)
			delete(rawMsg, key)
		case "effectiveDate":
			err = unpopulateTimeRFC3339(val, "EffectiveDate", &g.EffectiveDate)
			delete(rawMsg, key)
		case "expirationDate":
			err = unpopulateTimeRFC3339(val, "ExpirationDate", &g.ExpirationDate)
			delete(rawMsg, key)
		case "offerCap":
			err = unpopulate(val, "OfferCap", &g.OfferCap)
			delete(rawMsg, key)
		case "offerType":
			err = unpopulate(val, "OfferType", &g.OfferType)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &g.Status)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", g, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type GrantDetails.
func (g GrantDetails) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "id", g.ID)
	populate(objectMap, "name", g.Name)
	populate(objectMap, "properties", g.Properties)
	populate(objectMap, "systemData", g.SystemData)
	populate(objectMap, "type", g.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type GrantDetails.
func (g *GrantDetails) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", g, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &g.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &g.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &g.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &g.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &g.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", g, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type GrantListResponse.
func (g GrantListResponse) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "nextLink", g.NextLink)
	populate(objectMap, "value", g.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type GrantListResponse.
func (g *GrantListResponse) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", g, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &g.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &g.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", g, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type InviteCodeGenerateRequest.
func (i InviteCodeGenerateRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "maxStudentCount", i.MaxStudentCount)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type InviteCodeGenerateRequest.
func (i *InviteCodeGenerateRequest) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", i, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "maxStudentCount":
			err = unpopulate(val, "MaxStudentCount", &i.MaxStudentCount)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", i, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type JoinRequestDetails.
func (j JoinRequestDetails) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "id", j.ID)
	populate(objectMap, "name", j.Name)
	populate(objectMap, "properties", j.Properties)
	populate(objectMap, "systemData", j.SystemData)
	populate(objectMap, "type", j.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type JoinRequestDetails.
func (j *JoinRequestDetails) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", j, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &j.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &j.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &j.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &j.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &j.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", j, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type JoinRequestList.
func (j JoinRequestList) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "nextLink", j.NextLink)
	populate(objectMap, "value", j.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type JoinRequestList.
func (j *JoinRequestList) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", j, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &j.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &j.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", j, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type JoinRequestProperties.
func (j JoinRequestProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "email", j.Email)
	populate(objectMap, "firstName", j.FirstName)
	populate(objectMap, "lastName", j.LastName)
	populate(objectMap, "status", j.Status)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type JoinRequestProperties.
func (j *JoinRequestProperties) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", j, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "email":
			err = unpopulate(val, "Email", &j.Email)
			delete(rawMsg, key)
		case "firstName":
			err = unpopulate(val, "FirstName", &j.FirstName)
			delete(rawMsg, key)
		case "lastName":
			err = unpopulate(val, "LastName", &j.LastName)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &j.Status)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", j, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type LabDetails.
func (l LabDetails) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "id", l.ID)
	populate(objectMap, "name", l.Name)
	populate(objectMap, "properties", l.Properties)
	populate(objectMap, "systemData", l.SystemData)
	populate(objectMap, "type", l.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type LabDetails.
func (l *LabDetails) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", l, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &l.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &l.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &l.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &l.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &l.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", l, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type LabListResult.
func (l LabListResult) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "nextLink", l.NextLink)
	populate(objectMap, "value", l.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type LabListResult.
func (l *LabListResult) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", l, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &l.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &l.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", l, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type LabProperties.
func (l LabProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "budgetPerStudent", l.BudgetPerStudent)
	populate(objectMap, "description", l.Description)
	populate(objectMap, "displayName", l.DisplayName)
	populateTimeRFC3339(objectMap, "effectiveDate", l.EffectiveDate)
	populateTimeRFC3339(objectMap, "expirationDate", l.ExpirationDate)
	populate(objectMap, "invitationCode", l.InvitationCode)
	populate(objectMap, "maxStudentCount", l.MaxStudentCount)
	populate(objectMap, "status", l.Status)
	populate(objectMap, "totalAllocatedBudget", l.TotalAllocatedBudget)
	populate(objectMap, "totalBudget", l.TotalBudget)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type LabProperties.
func (l *LabProperties) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", l, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "budgetPerStudent":
			err = unpopulate(val, "BudgetPerStudent", &l.BudgetPerStudent)
			delete(rawMsg, key)
		case "description":
			err = unpopulate(val, "Description", &l.Description)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &l.DisplayName)
			delete(rawMsg, key)
		case "effectiveDate":
			err = unpopulateTimeRFC3339(val, "EffectiveDate", &l.EffectiveDate)
			delete(rawMsg, key)
		case "expirationDate":
			err = unpopulateTimeRFC3339(val, "ExpirationDate", &l.ExpirationDate)
			delete(rawMsg, key)
		case "invitationCode":
			err = unpopulate(val, "InvitationCode", &l.InvitationCode)
			delete(rawMsg, key)
		case "maxStudentCount":
			err = unpopulate(val, "MaxStudentCount", &l.MaxStudentCount)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &l.Status)
			delete(rawMsg, key)
		case "totalAllocatedBudget":
			err = unpopulate(val, "TotalAllocatedBudget", &l.TotalAllocatedBudget)
			delete(rawMsg, key)
		case "totalBudget":
			err = unpopulate(val, "TotalBudget", &l.TotalBudget)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", l, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type Operation.
func (o Operation) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "actionType", o.ActionType)
	populate(objectMap, "display", o.Display)
	populate(objectMap, "isDataAction", o.IsDataAction)
	populate(objectMap, "name", o.Name)
	populate(objectMap, "origin", o.Origin)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Operation.
func (o *Operation) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "actionType":
			err = unpopulate(val, "ActionType", &o.ActionType)
			delete(rawMsg, key)
		case "display":
			err = unpopulate(val, "Display", &o.Display)
			delete(rawMsg, key)
		case "isDataAction":
			err = unpopulate(val, "IsDataAction", &o.IsDataAction)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &o.Name)
			delete(rawMsg, key)
		case "origin":
			err = unpopulate(val, "Origin", &o.Origin)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type OperationDisplay.
func (o OperationDisplay) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "description", o.Description)
	populate(objectMap, "operation", o.Operation)
	populate(objectMap, "provider", o.Provider)
	populate(objectMap, "resource", o.Resource)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.
func (o *OperationDisplay) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "description":
			err = unpopulate(val, "Description", &o.Description)
			delete(rawMsg, key)
		case "operation":
			err = unpopulate(val, "Operation", &o.Operation)
			delete(rawMsg, key)
		case "provider":
			err = unpopulate(val, "Provider", &o.Provider)
			delete(rawMsg, key)
		case "resource":
			err = unpopulate(val, "Resource", &o.Resource)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type OperationListResult.
func (o OperationListResult) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "nextLink", o.NextLink)
	populate(objectMap, "value", o.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.
func (o *OperationListResult) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", o, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &o.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &o.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", o, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type RedeemRequest.
func (r RedeemRequest) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "firstName", r.FirstName)
	populate(objectMap, "lastName", r.LastName)
	populate(objectMap, "redeemCode", r.RedeemCode)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type RedeemRequest.
func (r *RedeemRequest) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", r, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "firstName":
			err = unpopulate(val, "FirstName", &r.FirstName)
			delete(rawMsg, key)
		case "lastName":
			err = unpopulate(val, "LastName", &r.LastName)
			delete(rawMsg, key)
		case "redeemCode":
			err = unpopulate(val, "RedeemCode", &r.RedeemCode)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", r, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "id", r.ID)
	populate(objectMap, "name", r.Name)
	populate(objectMap, "systemData", r.SystemData)
	populate(objectMap, "type", r.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type Resource.
func (r *Resource) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", r, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &r.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &r.Name)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &r.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &r.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", r, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type StudentDetails.
func (s StudentDetails) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "id", s.ID)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "properties", s.Properties)
	populate(objectMap, "systemData", s.SystemData)
	populate(objectMap, "type", s.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type StudentDetails.
func (s *StudentDetails) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &s.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &s.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &s.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type StudentLabDetails.
func (s StudentLabDetails) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "id", s.ID)
	populate(objectMap, "name", s.Name)
	populate(objectMap, "properties", s.Properties)
	populate(objectMap, "systemData", s.SystemData)
	populate(objectMap, "type", s.Type)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type StudentLabDetails.
func (s *StudentLabDetails) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "id":
			err = unpopulate(val, "ID", &s.ID)
			delete(rawMsg, key)
		case "name":
			err = unpopulate(val, "Name", &s.Name)
			delete(rawMsg, key)
		case "properties":
			err = unpopulate(val, "Properties", &s.Properties)
			delete(rawMsg, key)
		case "systemData":
			err = unpopulate(val, "SystemData", &s.SystemData)
			delete(rawMsg, key)
		case "type":
			err = unpopulate(val, "Type", &s.Type)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type StudentLabListResult.
func (s StudentLabListResult) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "nextLink", s.NextLink)
	populate(objectMap, "value", s.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type StudentLabListResult.
func (s *StudentLabListResult) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &s.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &s.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type StudentLabProperties.
func (s StudentLabProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "budget", s.Budget)
	populate(objectMap, "description", s.Description)
	populate(objectMap, "displayName", s.DisplayName)
	populateTimeRFC3339(objectMap, "effectiveDate", s.EffectiveDate)
	populateTimeRFC3339(objectMap, "expirationDate", s.ExpirationDate)
	populate(objectMap, "labScope", s.LabScope)
	populate(objectMap, "role", s.Role)
	populate(objectMap, "status", s.Status)
	populate(objectMap, "subscriptionId", s.SubscriptionID)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type StudentLabProperties.
func (s *StudentLabProperties) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "budget":
			err = unpopulate(val, "Budget", &s.Budget)
			delete(rawMsg, key)
		case "description":
			err = unpopulate(val, "Description", &s.Description)
			delete(rawMsg, key)
		case "displayName":
			err = unpopulate(val, "DisplayName", &s.DisplayName)
			delete(rawMsg, key)
		case "effectiveDate":
			err = unpopulateTimeRFC3339(val, "EffectiveDate", &s.EffectiveDate)
			delete(rawMsg, key)
		case "expirationDate":
			err = unpopulateTimeRFC3339(val, "ExpirationDate", &s.ExpirationDate)
			delete(rawMsg, key)
		case "labScope":
			err = unpopulate(val, "LabScope", &s.LabScope)
			delete(rawMsg, key)
		case "role":
			err = unpopulate(val, "Role", &s.Role)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &s.Status)
			delete(rawMsg, key)
		case "subscriptionId":
			err = unpopulate(val, "SubscriptionID", &s.SubscriptionID)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type StudentListResult.
func (s StudentListResult) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "nextLink", s.NextLink)
	populate(objectMap, "value", s.Value)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type StudentListResult.
func (s *StudentListResult) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "nextLink":
			err = unpopulate(val, "NextLink", &s.NextLink)
			delete(rawMsg, key)
		case "value":
			err = unpopulate(val, "Value", &s.Value)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type StudentProperties.
func (s StudentProperties) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populate(objectMap, "budget", s.Budget)
	populateTimeRFC3339(objectMap, "effectiveDate", s.EffectiveDate)
	populate(objectMap, "email", s.Email)
	populateTimeRFC3339(objectMap, "expirationDate", s.ExpirationDate)
	populate(objectMap, "firstName", s.FirstName)
	populate(objectMap, "lastName", s.LastName)
	populate(objectMap, "role", s.Role)
	populate(objectMap, "status", s.Status)
	populate(objectMap, "subscriptionAlias", s.SubscriptionAlias)
	populate(objectMap, "subscriptionId", s.SubscriptionID)
	populateTimeRFC3339(objectMap, "subscriptionInviteLastSentDate", s.SubscriptionInviteLastSentDate)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type StudentProperties.
func (s *StudentProperties) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "budget":
			err = unpopulate(val, "Budget", &s.Budget)
			delete(rawMsg, key)
		case "effectiveDate":
			err = unpopulateTimeRFC3339(val, "EffectiveDate", &s.EffectiveDate)
			delete(rawMsg, key)
		case "email":
			err = unpopulate(val, "Email", &s.Email)
			delete(rawMsg, key)
		case "expirationDate":
			err = unpopulateTimeRFC3339(val, "ExpirationDate", &s.ExpirationDate)
			delete(rawMsg, key)
		case "firstName":
			err = unpopulate(val, "FirstName", &s.FirstName)
			delete(rawMsg, key)
		case "lastName":
			err = unpopulate(val, "LastName", &s.LastName)
			delete(rawMsg, key)
		case "role":
			err = unpopulate(val, "Role", &s.Role)
			delete(rawMsg, key)
		case "status":
			err = unpopulate(val, "Status", &s.Status)
			delete(rawMsg, key)
		case "subscriptionAlias":
			err = unpopulate(val, "SubscriptionAlias", &s.SubscriptionAlias)
			delete(rawMsg, key)
		case "subscriptionId":
			err = unpopulate(val, "SubscriptionID", &s.SubscriptionID)
			delete(rawMsg, key)
		case "subscriptionInviteLastSentDate":
			err = unpopulateTimeRFC3339(val, "SubscriptionInviteLastSentDate", &s.SubscriptionInviteLastSentDate)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

// MarshalJSON implements the json.Marshaller interface for type SystemData.
func (s SystemData) MarshalJSON() ([]byte, error) {
	objectMap := make(map[string]interface{})
	populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt)
	populate(objectMap, "createdBy", s.CreatedBy)
	populate(objectMap, "createdByType", s.CreatedByType)
	populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt)
	populate(objectMap, "lastModifiedBy", s.LastModifiedBy)
	populate(objectMap, "lastModifiedByType", s.LastModifiedByType)
	return json.Marshal(objectMap)
}

// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.
func (s *SystemData) UnmarshalJSON(data []byte) error {
	var rawMsg map[string]json.RawMessage
	if err := json.Unmarshal(data, &rawMsg); err != nil {
		return fmt.Errorf("unmarshalling type %T: %v", s, err)
	}
	for key, val := range rawMsg {
		var err error
		switch key {
		case "createdAt":
			err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt)
			delete(rawMsg, key)
		case "createdBy":
			err = unpopulate(val, "CreatedBy", &s.CreatedBy)
			delete(rawMsg, key)
		case "createdByType":
			err = unpopulate(val, "CreatedByType", &s.CreatedByType)
			delete(rawMsg, key)
		case "lastModifiedAt":
			err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt)
			delete(rawMsg, key)
		case "lastModifiedBy":
			err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy)
			delete(rawMsg, key)
		case "lastModifiedByType":
			err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType)
			delete(rawMsg, key)
		}
		if err != nil {
			return fmt.Errorf("unmarshalling type %T: %v", s, err)
		}
	}
	return nil
}

func populate(m map[string]interface{}, k string, v interface{}) {
	if v == nil {
		return
	} else if azcore.IsNullValue(v) {
		m[k] = nil
	} else if !reflect.ValueOf(v).IsNil() {
		m[k] = v
	}
}

func unpopulate(data json.RawMessage, fn string, v interface{}) error {
	if data == nil {
		return nil
	}
	if err := json.Unmarshal(data, v); err != nil {
		return fmt.Errorf("struct field %s: %v", fn, err)
	}
	return nil
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using OldSkull;
using OldSkull.Utils;
using Monocle;
using OldSkull.GameLevel;

namespace Iseult
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class IseultGame : OldSkullGame
    {
        static public Atlas Atlas1;
        static public SpriteFont FontText { get; private set; }

        public IseultGame()
            : base(1366,768,60)
        { }

        static void Main(string[] args)
        {
            using (IseultGame demo = new IseultGame())
            {
                demo.Run();
            }
        }

        protected override void LoadContent()
        {
            base.LoadContent();

            Atlas = new Atlas(Path + @"Content/Atlas/atlas0.xml", true);
            Atlas1 = new Atlas(Path + @"Content/Atlas/atlas1.xml", true);

            SpriteData = new SpriteData(Path + @"Content/Atlas/SpriteData.xml", new Atlas[] { Atlas, Atlas1 });
            Font = Content.Load<SpriteFont>(@"Misc/medieval");
            FontText = Content.Load<SpriteFont>(@"Misc/celtic");
        }

        protected override void Initialize()
        {
            base.Initialize();
            Screen.Scale = 1;

            Scene = new UI.Logos();
            EnemyTracker.Init();
            Sounds.Init();
            Sounds.Load(new string[]{
                "VINHETA"
            });

            Commands.RegisterCommand("goto", (args) =>
            {
                if (File.Exists(OldSkullGame.Path + @"Content\Level\" + args[0] + ".oel"))
                {
                    IseultPlayer.AliveTime = 0;
                    PlatformerLevelLoader loader = PlatformerLevelLoader.load(args[0]);
                    GameLevel level = new GameLevel(loader, PlatformerLevel.Side.Debug);

                    Engine.Instance.Scene = level;
                }
                else
                {
                    Commands.Log("Cannot find the file " + args[0] + ".oel");
                }
            });
        }

    }
}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=struct.ObjectKeyWriter.html">

Redirecting to struct.ObjectKeyWriter.html...


text:
__author__ = 'jcorbett'

DEBUG = False
TESTING = False
MONGODB_HOSTNAME = "localhost"
MONGODB_DBNAME = "slickij"
LOG_PATH = "/var/log/slick.log"
LOG_FORMAT = "[%(asctime)s|%(levelname) 8s|%(name)s]: %(message)s"
LOG_DATE_FORMAT = "%x %I:%M:%S %p"
LOG_LEVEL = "INFO"
APPLICATION_ROOT = "/"
DEVELOPMENT = False


text:
package cost.healthcare.core.util;

import cost.healthcare.core.annotation.DataTransferObject;
import org.reflections.Reflections;

import java.lang.annotation.Annotation;
import java.util.Iterator;
import java.util.Set;

public abstract class StartupReflection
{
    public static void getDataTransferObjects()
    {
        Reflections reflections = new Reflections("cost.healthcare.core.model");
        Set<Class<?>> classesSet = reflections.getTypesAnnotatedWith(DataTransferObject.class);
        DTORegistry dtoRegistry = DTORegistry.getInstance();
        Iterator<Class<?>> iterator = classesSet.iterator();
        while (iterator.hasNext())
        {
            Class className = iterator.next();
            Annotation[] annotations = className.getAnnotations();
            for (Annotation annotation : annotations)
            {
                if (DataTransferObject.class.equals(annotation.annotationType()))
                {
                    DataTransferObject dataTransferObject = (DataTransferObject) annotation;
                    String value = dataTransferObject.value();
                    dtoRegistry.addDTO(value, className);
                }
            }
        }
    }
}


text:
package com.jobxhub.common.util.internal;

import com.jobxhub.common.logging.LoggerFactory;
import com.jobxhub.common.util.SystemPropertyUtils;
import org.slf4j.Logger;

import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;

import static com.jobxhub.common.util.ExceptionUtils.stackTrace;

/**
 * For the {@link sun.misc.Unsafe} access.
 */
public final class Unsafe {

    private static final Logger logger = LoggerFactory.getLogger(SystemPropertyUtils.class);

    private static final sun.misc.Unsafe UNSAFE;

    static {
        sun.misc.Unsafe unsafe;
        try {
            Field unsafeField = sun.misc.Unsafe.class.getDeclaredField("theUnsafe");
            unsafeField.setAccessible(true);
            unsafe = (sun.misc.Unsafe) unsafeField.get(null);
        } catch (Throwable t) {
            if (logger.isWarnEnabled()) {
                logger.warn("sun.misc.Unsafe.theUnsafe: unavailable, {}.", stackTrace(t));
            }

            unsafe = null;
        }

        UNSAFE = unsafe;
    }

    /**
     * Returns the {@link sun.misc.Unsafe}'s instance.
     */
    public static sun.misc.Unsafe getUnsafe() {
        return UNSAFE;
    }

    /**
     * Returns the system {@link ClassLoader}.
     */
    public static ClassLoader getSystemClassLoader() {
        if (System.getSecurityManager() == null) {
            return ClassLoader.getSystemClassLoader();
        } else {
            return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {

                @Override
                public ClassLoader run() {
                    return ClassLoader.getSystemClassLoader();
                }
            });
        }
    }

    private Unsafe() {
    }
}


text:
class CountingSort {

  def countSort(listToBeSorted: List[Int], minValue: Int, maxValue: Int): List[Int] =

    listToBeSorted.foldLeft(Array.fill(maxValue - minValue + 1)(0)) { (arr, n) =>
      arr(n - minValue) += 1
      arr
    }.zipWithIndex.foldLeft(List[Int]()) {
      case (lst, (cnt, ndx)) => List.fill(cnt)(ndx + minValue) ::: lst
    }.reverse
}


text:
/* @flow */
/* React, browser and server rendering functions. We need the
 * first import as JSX compiled to React.createComponent(...) */
import React from 'react';
import { render as renderToDom } from 'react-dom';
import { renderToString } from 'react-dom/server';
import Helmet from 'react-helmet';

/* Hot-module reloading */
import { AppContainer } from 'react-hot-loader'

/* State management with redux */
import { Provider } from 'react-redux';

/* Routing with react-router */
import { StaticRouter } from 'react-router';
import { BrowserRouter } from 'react-router-dom';

import App from './containers/App';

import createStore from './createStore';

/* Client-side rendering. We rehydrate the Redux store and plugin it into the page render.*/
if (typeof window !== 'undefined') {
  // Only create the store once!
  const store = createStore(window.__INITIAL_STATE__);

  const render = Component => {
    const app = (
      <AppContainer>
        <Provider store={store}>
          <BrowserRouter>
            <Component />
          </BrowserRouter>
        </Provider>
      </AppContainer>
    );

    renderToDom(app, document.getElementById('root'));
  }

  render(App);

  // Register with Hot Module Replacement API
  if (module.hot) {
    module.hot.accept('./containers/App', () => { render(App) });
  }
}

/**
 * Performs server-side rendering. The function is exported because the templating function
 * that Spring will call uses this function to perform the meat of the rendering.
 *
 * @param path the path to the resource requested by the client
 * @param state the Redux state supplied by Spring and massaged by the template engine
 * @returns string the rendered page
 */
// eslint-disable-next-line import/prefer-default-export
export function renderApp(path : string, state : Object) {
  const store = createStore(state);

  // 404's will be handled by correct route definitions. Redirects will be handled by Spring.
  const markup = renderToString(
    <Provider store={ store }>
      <StaticRouter
        location={ path }
        context={ {} }
      >
        <App/>
      </StaticRouter>
    </Provider>
  )

  // Free accumulated object to avoid memory leak and return data to parent renderer
  const head = Helmet.rewind();

  return { markup, head };
}


text:
FROM local/ziggy_user

USER root
RUN apt-get update && apt-get install --yes python
RUN mkdir -pv /opt/nodejs && chown ziggy:ziggy /opt/nodejs
USER ziggy

# install node
RUN wget -qO- http://nodejs.org/dist/v0.10.36/node-v0.10.36-linux-x64.tar.gz | tar xvz -C /opt/nodejs
ENV PATH /opt/nodejs/node-v0.10.36-linux-x64/bin:$PATH

# bring in packages as global
RUN npm install -g browserify watchify jest-cli react-tools express coffee-script coffee-react-transform
ENV NODE_PATH /opt/nodejs/node-v0.10.36-linux-x64/lib/node_modules

# install support for serving static files
COPY share/express_static /home/ziggy/express_static/


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Python: module telemetry.internal.forwarders.do_nothing_forwarder</title>
<meta charset="utf-8">

<big><big>telemetry.internal.forwarders.do_nothing_forwarder</big></big>	index
telemetry/internal/forwarders/do_nothing_forwarder.py

<tt># Copyright 2014 The Chromium Authors. All rights reserved.

# Use of this source code is governed by a BSD-style license that can be

# found in the LICENSE file.</tt>

<big>Modules</big>

<tt>      </tt>

contextlib

telemetry.core.exceptions

	telemetry.internal.forwarders

logging

	socket

telemetry.core.util

<big>Classes</big>

<tt>      </tt>

exceptions.Exception(exceptions.BaseException)

Error

ConnectionError

PortsMismatchError

telemetry.internal.forwarders.Forwarder(__builtin__.object)

DoNothingForwarder

telemetry.internal.forwarders.ForwarderFactory(__builtin__.object)

DoNothingForwarderFactory

class ConnectionError(Error)

<tt>   </tt>
<tt>Raised when unable to connect to local TCP ports.
 </tt>

Method resolution order:

ConnectionError

Error

exceptions.Exception

exceptions.BaseException

__builtin__.object

Data descriptors inherited from Error:

__weakref__

<tt>list of weak references to the object (if defined)</tt>

Methods inherited from exceptions.Exception:

__init__(...)

<tt>x.__init__(...) initializes x; see help(type(x)) for signature</tt>

Data and other attributes inherited from exceptions.Exception:

__new__ = <built-in method __new__ of type object>
<tt>T.__new__(S, ...) -> a new object with type S, a subtype of T</tt>

Methods inherited from exceptions.BaseException:

__delattr__(...)

<tt>x.__delattr__('name') <==> del x.name</tt>

__getattribute__(...)

<tt>x.__getattribute__('name') <==> x.name</tt>

__getitem__(...)

<tt>x.__getitem__(y) <==> x[y]</tt>

__getslice__(...)

<tt>x.__getslice__(i, j) <==> x[i:j]

Use of negative indices is not supported.</tt>

__reduce__(...)

__repr__(...)

<tt>x.__repr__() <==> repr(x)</tt>

__setattr__(...)

<tt>x.__setattr__('name', value) <==> x.name = value</tt>

__setstate__(...)

__str__(...)

<tt>x.__str__() <==> str(x)</tt>

__unicode__(...)

Data descriptors inherited from exceptions.BaseException:

__dict__

args

message

class DoNothingForwarder(telemetry.internal.forwarders.Forwarder)

<tt>   </tt>
<tt>Check that no forwarding is needed for the given port pairs.

The local and remote ports must be equal. Otherwise, the "do nothing"

forwarder does not make sense. (Raises PortsMismatchError.)

Also, check that all TCP ports support connections.  (Raises ConnectionError.)
 </tt>

Method resolution order:

DoNothingForwarder

telemetry.internal.forwarders.Forwarder

__builtin__.object

Methods defined here:

__init__(self, port_pairs)

Methods inherited from telemetry.internal.forwarders.Forwarder:

Close(self)

Data descriptors inherited from telemetry.internal.forwarders.Forwarder:

__dict__

<tt>dictionary for instance variables (if defined)</tt>

__weakref__

<tt>list of weak references to the object (if defined)</tt>

host_ip

host_port

port_pairs

url

class DoNothingForwarderFactory(telemetry.internal.forwarders.ForwarderFactory)

<tt>   </tt>

Method resolution order:

DoNothingForwarderFactory

telemetry.internal.forwarders.ForwarderFactory

__builtin__.object

Methods defined here:

Create(self, port_pairs)

Data descriptors inherited from telemetry.internal.forwarders.ForwarderFactory:

__dict__

<tt>dictionary for instance variables (if defined)</tt>

__weakref__

<tt>list of weak references to the object (if defined)</tt>

does_forwarder_override_dns

host_ip

class Error(exceptions.Exception)

<tt>   </tt>
<tt>Base class for exceptions in this module.
 </tt>

Method resolution order:

Error

exceptions.Exception

exceptions.BaseException

__builtin__.object

Data descriptors defined here:

__weakref__

<tt>list of weak references to the object (if defined)</tt>

Methods inherited from exceptions.Exception:

__init__(...)

<tt>x.__init__(...) initializes x; see help(type(x)) for signature</tt>

Data and other attributes inherited from exceptions.Exception:

__new__ = <built-in method __new__ of type object>
<tt>T.__new__(S, ...) -> a new object with type S, a subtype of T</tt>

Methods inherited from exceptions.BaseException:

__delattr__(...)

<tt>x.__delattr__('name') <==> del x.name</tt>

__getattribute__(...)

<tt>x.__getattribute__('name') <==> x.name</tt>

__getitem__(...)

<tt>x.__getitem__(y) <==> x[y]</tt>

__getslice__(...)

<tt>x.__getslice__(i, j) <==> x[i:j]

Use of negative indices is not supported.</tt>

__reduce__(...)

__repr__(...)

<tt>x.__repr__() <==> repr(x)</tt>

__setattr__(...)

<tt>x.__setattr__('name', value) <==> x.name = value</tt>

__setstate__(...)

__str__(...)

<tt>x.__str__() <==> str(x)</tt>

__unicode__(...)

Data descriptors inherited from exceptions.BaseException:

__dict__

args

message

class PortsMismatchError(Error)

<tt>   </tt>
<tt>Raised when local and remote ports are not equal.
 </tt>

Method resolution order:

PortsMismatchError

Error

exceptions.Exception

exceptions.BaseException

__builtin__.object

Data descriptors inherited from Error:

__weakref__

<tt>list of weak references to the object (if defined)</tt>

Methods inherited from exceptions.Exception:

__init__(...)

<tt>x.__init__(...) initializes x; see help(type(x)) for signature</tt>

Data and other attributes inherited from exceptions.Exception:

__new__ = <built-in method __new__ of type object>
<tt>T.__new__(S, ...) -> a new object with type S, a subtype of T</tt>

Methods inherited from exceptions.BaseException:

__delattr__(...)

<tt>x.__delattr__('name') <==> del x.name</tt>

__getattribute__(...)

<tt>x.__getattribute__('name') <==> x.name</tt>

__getitem__(...)

<tt>x.__getitem__(y) <==> x[y]</tt>

__getslice__(...)

<tt>x.__getslice__(i, j) <==> x[i:j]

Use of negative indices is not supported.</tt>

__reduce__(...)

__repr__(...)

<tt>x.__repr__() <==> repr(x)</tt>

__setattr__(...)

<tt>x.__setattr__('name', value) <==> x.name = value</tt>

__setstate__(...)

__str__(...)

<tt>x.__str__() <==> str(x)</tt>

__unicode__(...)

Data descriptors inherited from exceptions.BaseException:

__dict__

args

message


text:
require 'gogokit/utils'
require 'gogokit/resource/currency'

module GogoKit
  class Client
    # {GogoKit::Client} methods for getting currencies
    module Currency
      include GogoKit::Utils

      # Retrieves a currency by currency code
      #
      # @param [String] code The currency code of the currency to be retrieved
      # @param [Hash] options Optional options
      # @return [GogoKit::Country] The requested currency
      def get_currency(code, options = {})
        root = get_root
        object_from_response(GogoKit::Currency,
                             GogoKit::CurrencyRepresenter,
                             :get,
                             "#{root.links['self'].href}/currencies/#{code}",
                             options)
      end

      # Retrieves all currencies supported by viagogo
      #
      # @see http://viagogo.github.io/developer.viagogo.net/#viagogocurrencies
      # @param [Hash] options Optional options
      # @return [GogoKit::PagedResource] All currencies
      def get_currencies(options = {})
        object_from_response(GogoKit::PagedResource,
                             GogoKit::CurrenciesRepresenter,
                             :get,
                             get_root.links['viagogo:currencies'].href,
                             options)
      end
    end
  end
end


text:
from __future__ import absolute_import
from __future__ import print_function
import requests

class SpellCheckerProvider(object):
    def __init__(self, server_addr):
        self.server_addr = server_addr

    def spell_check(self, word):
        payload = {'word': word}
        r = requests.post(self.server_addr, json=payload)
        if r.status_code != 200:
            raise ValueError('unrecognized format')
        result = r.json()
        if 'result' in result:
            return result['result']
        else:
            raise ValueError('unrecognized format')


text:
package archive

import (
	"io"

	"github.com/klauspost/compress/zstd"
)

type wrapperZstdDecoder struct {
	decoder *zstd.Decoder
}

func (w *wrapperZstdDecoder) Close() error {
	w.decoder.Close()
	return nil
}

func (w *wrapperZstdDecoder) DecodeAll(input, dst []byte) ([]byte, error) {
	return w.decoder.DecodeAll(input, dst)
}

func (w *wrapperZstdDecoder) Read(p []byte) (int, error) {
	return w.decoder.Read(p)
}

func (w *wrapperZstdDecoder) Reset(r io.Reader) error {
	return w.decoder.Reset(r)
}

func (w *wrapperZstdDecoder) WriteTo(wr io.Writer) (int64, error) {
	return w.decoder.WriteTo(wr)
}

func zstdReader(buf io.Reader) (io.ReadCloser, error) {
	decoder, err := zstd.NewReader(buf)
	return &wrapperZstdDecoder{decoder: decoder}, err
}

func zstdWriter(dest io.Writer) (io.WriteCloser, error) {
	return zstd.NewWriter(dest)
}


text:
$(function() {
    var gamepad = new Gamepad();
    var ongoingTouches = [];
    var dpadDirections = {up: false, down: false, left: false, right: false};

    function initControls() {
        $('#controller').on('touchstart', '.button', handleButtonStart);
        $('#controller').on('touchend', '.button', handleButtonEnd);
        $('#controller').on('touchstart', '#dpad', handleDpadStart);
        $('#controller').on('touchmove', '#dpad', handleDpadMove);
        $('#controller').on('touchend', '#dpad', handleDpadEnd);
    }

    gamepad.socket.on('connect', function() {
        gamepad.connectGamepad(initControls);
    })
    initControls();

    navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
    var hapticCallback = function () {
        if (navigator.vibrate) {
            navigator.vibrate(50);
        }
    };

    function copyTouch(touch) {
        return { identifier: touch.identifier, pageX: touch.pageX, pageY: touch.pageY, target: touch.target };
    }

    function findOngoingTouch(id) {
       ongoingTouches.forEach(function(touch, i) {
           if (touch.identifier === id) return i;
       });
       return -1;
    }

    function handleButtonStart(e) {
        for (var i=0; i<e.changedTouches.length; i++) {
            var touch = e.changedTouches[i];
            ongoingTouches.push(copyTouch(touch));
            var button = touch.target.id;
            console.log(`${button} pressed`);
            gamepad.setButton(button, true);
            hapticCallback();
        }
    }

    function handleButtonEnd(e) {
        for (var i=0; i<e.changedTouches.length; i++) {
            var touch = e.changedTouches[i];
            var index = findOngoingTouch(touch.identifier);
            var button = touch.target.id;
            console.log(`${button} unpressed`);
            gamepad.setButton(button, false);
            ongoingTouches.splice(index, 1);
        }
    }

    function getDpadDirections(x, y) {
        var $dpad = $('#dpad');
        var offset = $dpad.offset();
        var width = $dpad.width();
        var height = $dpad.height();
        var centerX = offset.left + width / 2;
        var centerY = offset.top + height / 2;

        var deadzoneRatio = 0.2;
        var deadzoneWidth = width * deadzoneRatio;
        var deadzoneHeight = height * deadzoneRatio;
        var deadzone = {
            top: centerY - deadzoneHeight/2,
            bottom: centerY + deadzoneHeight/2,
            left: centerX - deadzoneWidth/2,
            right: centerX + deadzoneWidth/2
        }

        var newDirections = {up: true, down: true, left: true, right: true};

        if (x > deadzone.left && x < deadzone.right) {
            newDirections.left = false;
            newDirections.right = false;
        }
        if (y > deadzone.top && y < deadzone.bottom) {
            newDirections.up = false;
            newDirections.down = false;
        }
        if (x < centerX) newDirections.right = false;
        else if (x > centerX) newDirections.left = false;
        if (y < centerY) newDirections.down = false;
        else if (y > centerY) newDirections.up = false;

        return newDirections;
    }

    function handleDpadStart(e) {
        for (var i=0; i<e.originalEvent.changedTouches.length; i++) {
            var touch = e.originalEvent.changedTouches[i];
            ongoingTouches.push(copyTouch(touch));
            newDirections = getDpadDirections(touch.pageX, touch.pageY);
            gamepad.setDirection(dpadDirections, newDirections);
            dpadDirections = newDirections;
            hapticCallback();
        }
    }

    function handleDpadMove(e) {
        for (var i=0; i<e.originalEvent.changedTouches.length; i++) {
            var touch = e.originalEvent.changedTouches[i];
            var index = findOngoingTouch(touch.identifier);
            ongoingTouches.splice(index, 1, copyTouch(touch));
            newDirections = getDpadDirections(touch.pageX, touch.pageY);
            gamepad.setDirection(dpadDirections, newDirections);
            dpadDirections = newDirections;
        }
    }

    function handleDpadEnd(e) {
        for (var i=0; i<e.changedTouches.length; i++) {
            var touch = e.changedTouches[i];
            var index = findOngoingTouch(touch.identifier);
            ongoingTouches.splice(index, 1);
            console.log('dpad unpressed');
            var newDirections = {up: false, down: false, left: false, right: false};
            gamepad.setDirection(dpadDirections, newDirections);
            dpadDirections = newDirections;
        }
    }
});


text:
Photo gallery generator. Uses JSON metainfo files in the original images tree.

Features:

 * Custom templates
 * Incremental updates
 * Fixed-sized no-distortion thumbnails
 * Output directory separated from the source images directory
 * Unbounded album nesting

## Usage

    Options:

        -h, --help               output usage information
        -V, --version            output the version number
        --base <directory>       The base directory.
        --target <directory>     The target directory.
        --templates <directory>  The templates directory.
        --force                  Force the recreation of thumbnails/target images.
        --thumbnail <size>       Thumbnail size (example: 300x200).
        --normal <size>          Normal max width (example: 1200).

## Metainfo

Metainfo is stored in `info.json` files (one per directory). Supported metainfo:

```javascript
{
    "title": String,
    "description": String, // can contain HTML
    "cover": String, // relative path to cover image,
    "order": String, // currently only "year" is supported,
    "year": Number   // album year, used for sorting in the parent
}
```

Fields `description`, `cover`, `order` and `year` can be missing.

## Templates

See the `example-templates` directory.

## Dependencies

ImageMagick > 6.3.8 must be installed.

## Debugging

Run with `DEBUG=* rla-gallery-gen`.

## License

The MIT License. See the LICENSE file.


text:
package org.dashbuilder.dataset.engine.filter;

import org.dashbuilder.dataset.DataSet;

/**
 * A data set context
 */
public class DataSetFilterContext {

    private DataSet dataSet;
    private int currentRow = 0;

    public DataSetFilterContext() {
    }

    public DataSetFilterContext(DataSet dataSet) {
        this.dataSet = dataSet;
    }

    public DataSet getDataSet() {
        return dataSet;
    }

    public void setDataSet(DataSet dataSet) {
        this.dataSet = dataSet;
    }

    public int getCurrentRow() {
        return currentRow;
    }

    public void setCurrentRow(int currentRow) {
        this.currentRow = currentRow;
    }
}


text:
using System;
using NUnit.Framework;
using SocialToolBox.Cms.Page;
using SocialToolBox.Cms.Page.Event;
using SocialToolBox.Cms.Page.Projection;
using SocialToolBox.Core.Database;
using SocialToolBox.Core.Entity;
using SocialToolBox.Core.Mocks.Database;

namespace SocialToolBox.Cms.Tests.Page.Projection
{
    [TestFixture]
    public class Page_as_entity_page
    {
        public PageModule Pages;
        public EntityModule Entities;
        public ProjectionEngine Projections;
        public ICursor Cursor;

        public Id IdA = Id.Parse("aaaaaaaaaaa");
        public Id IdUser = Id.Parse("user123user");

        [SetUp]
        public void SetUp()
        {
            var driver = new DatabaseDriver();
            Pages = new PageModule(driver);
            Entities = new EntityModule(driver);
            Pages.RegisterPagesAsEntities(Entities);
            Projections = driver.Projections;
            Cursor = driver.OpenReadWriteCursor();

            Entities.Compile();
        }
        [Test]
        public void initially_empty()
        {
            Assert.IsNull(Entities.Pages.Get(IdA, Cursor).Result);
        }

        [Test]
        public void create_provides_title()
        {
            Pages.Stream.AddEvent(new PageCreated(IdA, DateTime.Parse("2011/05/14"), IdUser), Cursor);
            Projections.Run();

            Assert.AreEqual(typeof(PageAsEntityPage), Entities.Pages.Get(IdA, Cursor).Result.GetType());
            Assert.IsNull(Entities.Pages.Get(IdA, Cursor).Result.Title);
        }

        [Test]
        public void update_changes_title()
        {
            Pages.Stream.AddEvent(new PageCreated(IdA, DateTime.Parse("2011/05/14"), IdUser), Cursor);
            Pages.Stream.AddEvent(new PageTitleUpdated(IdA, DateTime.Parse("2011/05/14"), IdUser, "About us"), Cursor);
            Projections.Run();

            var page = Entities.Pages.Get(IdA, Cursor).Result;

            Assert.AreEqual("About us", page.Title);
        }

        [Test]
        public void delete_removes_page()
        {
            Pages.Stream.AddEvent(new PageCreated(IdA, DateTime.Parse("2011/05/14"), IdUser), Cursor);
            Pages.Stream.AddEvent(new PageDeleted(IdA, DateTime.Parse("2011/05/14"), IdUser), Cursor);
            Projections.Run();

            Assert.IsNull(Entities.Pages.Get(IdA, Cursor).Result);
        }

        [Test]
        public void missing_without_create()
        {
            Pages.Stream.AddEvent(new PageTitleUpdated(IdA, DateTime.Parse("2011/05/14"), IdUser, "About us"), Cursor);
            Projections.Run();

            Assert.IsNull(Entities.Pages.Get(IdA, Cursor).Result);
        }
    }
}


text:
<!doctype html>

    <meta charset="utf-8">

<title>Layout: Author Sidebar Disabled - Witty AI</title>

<meta name="description" content="A post to test disabling author sidebar.">

<meta property="og:locale" content="en_US">
<meta property="og:site_name" content="Witty AI">
<meta property="og:title" content="Layout: Author Sidebar Disabled">

  <link rel="canonical" href="http://localhost:4000/layout-author-sidebar-disabled/">
  <meta property="og:url" content="http://localhost:4000/layout-author-sidebar-disabled/">

  <meta property="og:description" content="A post to test disabling author sidebar.">

  <meta name="twitter:site" content="@mmistakes">
  <meta name="twitter:title" content="Layout: Author Sidebar Disabled">
  <meta name="twitter:description" content="A post to test disabling author sidebar.">
  <meta name="twitter:url" content="http://localhost:4000/layout-author-sidebar-disabled/">

    <meta name="twitter:card" content="summary">

      <meta name="twitter:image" content="http://localhost:4000/assets/images/site-logo.png">

  <meta property="og:image" content="http://localhost:4000/assets/images/site-logo.png">

  <meta property="og:type" content="article">
  <meta property="article:published_time" content="2012-03-15T00:00:00-04:00">

  <meta name="google-site-verification" content="UQj93ERU9zgECodaaXgVpkjrFn9UrDMEzVamacSoQ8Y" />

<link href="http://localhost:4000/feed.xml" type="application/atom+xml" rel="alternate" title="Witty AI Feed">

<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="http://localhost:4000/assets/css/main.css">

<meta http-equiv="cleartype" content="on">

        <button>

</button>

Witty AI

Quick-Start Guide

About

Sample Posts

Sample Collections

Terms & Privacy Policy

    <meta itemprop="headline" content="Layout: Author Sidebar Disabled">
    <meta itemprop="description" content="A post to test disabling author sidebar.">
    <meta itemprop="datePublished" content="March 15, 2012">

Layout: Author Sidebar Disabled

	  less than 1 minute read

This post has the author sidebar disabled.

To disable add author_profile: false to YAML Front Matter.

 Updated: <time datetime="2012-03-15T00:00:00-04:00">March 15, 2012</time>

Share on

   Twitter

   Facebook

   Google+

   LinkedIn

      Previous

      Next

Leave a Comment

Your email address will not be published. Required fields are marked *

        <form id="new_comment" class="page__comments-form js-form form" method="post" action="https://api.staticman.net/v1/entry/mmistakes/minimal-mistakes/master">

            Loading...

          <fieldset>
            Comment *
            <textarea type="text" rows="3" id="comment-form-message" name="fields[message]" tabindex="1"></textarea>

Markdown is supported.

          </fieldset>
          <fieldset>
            Name *
            <input type="text" id="comment-form-name" name="fields[name]" tabindex="2" />
          </fieldset>
          <fieldset>
            Email address *
            <input type="email" id="comment-form-email" name="fields[email]" tabindex="3" />
          </fieldset>
          <fieldset>
            Website (optional)
            <input type="url" id="comment-form-url" name="fields[url]" tabindex="4"/>
          </fieldset>
          <fieldset class="hidden" style="display: none;">
            <input type="hidden" name="options[slug]" value="layout-author-sidebar-disabled">
            Not used. Leave blank if you are a human.
            <input type="text" id="comment-form-location" name="fields[hidden]" autocomplete="off"/>
          </fieldset>

          <fieldset>
            <button type="submit" id="comment-form-submit" tabindex="5" class="btn btn--large">Submit Comment</button>
          </fieldset>
        </form>

You May Also Enjoy

        Gemified Theme – Beta Release

	  2 minute read

Hot on the heels of Jekyll v3.3.0 is a beta release of Minimal Mistakes… as a gemified theme.

        Gemified Theme – Alpha Release

	  3 minute read

Jekyll themes distributed as Ruby gems are finally here to make installing and upgrading much easier. Gone are the days of forking a repo just to "install it...

        Welcome to Jekyll!

	  less than 1 minute read

You'll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different wa...

        Markup: Syntax Highlighting

	  1 minute read

Post displaying the various ways of highlighting code in Markdown.

Follow:

 Twitter

 Facebook

 GitHub

 Feed

© 2016 Ryan Skorupski. Powered by Jekyll & Minimal Mistakes.


text:
<?php
/**
 * Created by PhpStorm.
 * User: ashterix
 * Date: 30.04.17
 * Time: 8:58
 */

namespace Ufo\JsonRpcBundle\Security\Interfaces;

use Ufo\JsonRpcBundle\Exceptions\InvalidTokenException;

interface ITokenValidator
{
    /**
     * @param string $token
     * @return bool
     * @throws InvalidTokenException
     */
    public function isValid($token);
}


text:
VerificationSentViewModel Class
===============================
Holds data for the VerificationSent view.

Inheritance Hierarchy
---------------------
[System.Object][1]
  [MvcAccount.Shared.BaseViewModel][2]
    **MvcAccount.Password.Reset.VerificationSentViewModel**

**Namespace:** [MvcAccount.Password.Reset][3]
**Assembly:** MvcAccount (in MvcAccount.dll)

Syntax
------

```csharp
public class VerificationSentViewModel : BaseViewModel
```

The **VerificationSentViewModel** type exposes the following members.

Constructors
------------

                 | Name                           | Description
---------------- | ------------------------------ | ----------------------------------------------------------------------
![Public method] | [VerificationSentViewModel][4] | Initializes a new instance of the **VerificationSentViewModel** class.

Properties
----------

                      | Name              | Description
--------------------- | ----------------- | --------------------------------------------------------------------------------------------------
![Public property]    | [Message][5]      | A message for the user.
![Public property]    | [Title][6]        | The view's title, used on h1 and title elements. (Inherited from [BaseViewModel][2].)
![Protected property] | [Url][7]          | A [UrlHelper][8] for creating URLs. (Inherited from [BaseViewModel][2].)
![Public property]    | [ViewCssClass][9] | A space-separated list of CSS classes to be used in the view. (Inherited from [BaseViewModel][2].)

See Also
--------

#### Reference
[MvcAccount.Password.Reset Namespace][3]

[1]: http://msdn.microsoft.com/en-us/library/e5kfa45b
[2]: ../../MvcAccount.Shared/BaseViewModel/README.md
[3]: ../README.md
[4]: _ctor.md
[5]: Message.md
[6]: ../../MvcAccount.Shared/BaseViewModel/Title.md
[7]: ../../MvcAccount.Shared/BaseViewModel/Url.md
[8]: http://msdn.microsoft.com/en-us/library/dd492578
[9]: ../../MvcAccount.Shared/BaseViewModel/ViewCssClass.md
[Public method]: ../../_icons/pubmethod.gif "Public method"
[Public property]: ../../_icons/pubproperty.gif "Public property"
[Protected property]: ../../_icons/protproperty.gif "Protected property"


text:
External Web Clients
====================

You may want to build your own custom web applications using Girder. Since
Girder cleanly separates API from UI, it is straightforward to use a mounted
Girder API for app authentication and data storage. You may additionally
use Girder's JavaScript libraries and UI templates to assist in building
applications.

Including the Girder REST API
-----------------------------

Apache
^^^^^^

See the :ref:`deploy` section for instructions on deployment of Girder under
Apache. You may host your web application alongside Girder and use its
REST interface.

Tangelo
^^^^^^^

`Tangelo <http://tangelo.kitware.com>`_ is a CherryPy based web server framework
for rapid data analytics and visualization application development.
Tangelo has options for directly mounting the Girder API and static application
files inside a Tangelo instance. See details in Tangelo's
`setup <https://tangelo.readthedocs.org/en/latest/setup.html>`_ documentation.

Using Girder JavaScript Utilities and Views
-------------------------------------------

Including the JavaScript
^^^^^^^^^^^^^^^^^^^^^^^^

All Girder code is packaged within ES6 modules, and may be directly included in other web
applications via
`imports <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import>`_.
The `Webpack <https://webpack.js.org/>`_ tool is recommended as a way to resolve imports and build
deployable applications.

Extending Girder's Backbone application
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Girder defines a main application class, ``App``.  This object is responsible
for bootstrapping the application, setting up the overall layout, and responding
to global events like ``g:login`` and ``g:navigateTo``.  Developers can choose
to derive their own application from this class to use the functionality that
it provides.  For example, the following derivation would modify the normal
application bootstrapping

.. code-block:: javascript

    import Backbone from 'backbone';

    import { setCurrentUser } from 'girder/auth';
    import UserModel from 'girder/models/UserModel';
    import { setApiRoot } from 'girder/rest';
    import router from 'girder/router';
    import eventStream from 'girder/utilities/EventStream';
    import App from 'girder/views/App';

    // set the path where girder's API is mounted
    setApiRoot('/girder/api/v1');

    var MyApp = App.extend({
        start: function () {
            // disable girder's router
            router.enabled(false);

            // call the super method
            return App.prototype.start.call(this, {
                fetch: false,   // disable automatic fetching of the user model
                history: false, // disable initialization of Backbone's router
                render: false   // disable automatic rendering on start
            }).done(() => {
                // set the current user somehow
                setCurrentUser(new UserModel({...}));
                eventStream.open();

                // replace the header with a customized class
                this.headerView = new MyHeaderView({parentView: this});

                // render the main page
                this.render();

                // start up the router with the `pushState` option enabled
                Backbone.history.start({pushState: true});
            });
        }
    });

    // initialize the application without starting it
    var app = new MyApp({start: false});

    // start your application after the page loads
    $(function () {
        app.start();
    });

Other methods that one may need to override include the following:

``bindGirderEvents``
   Bind handlers to the global ``events`` object.

``render``
   Render (or re-render) the entire page.

.. note::
   ``router.enabled(false)`` must be set to false to disable URL routing
   behavior specific to the full Girder web application.

Using Girder Register and Login UI
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To use Girder UI components, you will need the following CSS file in your page:

.. code-block:: html

    <link rel="stylesheet" href="/girder/static/built/girder_lib.min.css">

To make login and logout controls, provide a dialog container and
login/logout/register links, and a container where the dialogs will be rendered:

.. code-block:: html

    <button class="btn btn-link" id="login" href="#">Login</button>
    <button class="btn btn-link" id="register" href="#">Register</button>

    <button class="btn btn-link hidden" id="logout" href="#">Logout</button>

In your JavaScript, perform callbacks such as the following:

.. code-block:: javascript

    import { getCurrentUser, setCurrentUser } from 'girder/auth';
    import events from 'girder/events';
    import UserModel from 'girder/models/UserModel';
    import { restRequest } from 'girder/rest';
    import LoginView from 'girder/views/layout/LoginView';
    import RegisterView from 'girder/views/layout/RegisterView';

    $('#login').click(function () {
        var loginView = new LoginView({
            el: $('#dialog-container')
        });
        loginView.render();
    });

    $('#register').click(function () {
        var registerView = new RegisterView({
            el: $('#dialog-container')
        });
        registerView.render();
    });

    $('#logout').click(function () {
        restRequest({
            url: 'user/authentication',
            type: 'DELETE'
        }).done(function () {
            setCurrentUser(null);
            events.trigger('g:login');
        });
    });

    events.on('g:login', function () {
        console.log('g:login');
        var currentUser = getCurrentUser();
        if (currentUser) {
            $('#login').addClass('hidden');
            $('#register').addClass('hidden');
            $('#name').removeClass('hidden');
            $('#logout').removeClass('hidden');
            $('#name').text(currentUser.get('firstName') + ' ' + currentUser.get('lastName'));

            // Do anything else you'd like to do on login.
        } else {
            $('#login').removeClass('hidden');
            $('#register').removeClass('hidden');
            $('#name').addClass('hidden');
            $('#logout').addClass('hidden');

            // Do anything else you'd like to do on logout.
        }
    });

    // Check for who is logged in initially
    restRequest({
        url: 'user/authentication',
        error: null
    }).done(function (resp) {
        setCurrentUser(UserModel(resp.user));
        events.trigger('g:login');
    });


text:
@extends('layouts.app')
@section('content')

{{$msg}}

@endsection


text:
"""empty message

Revision ID: 50fcee1753d
Revises: 2c579199005
Create Date: 2016-01-26 17:59:25.021819

"""

# revision identifiers, used by Alembic.
revision = '50fcee1753d'
down_revision = '2c579199005'

from alembic import op
import sqlalchemy as sa

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('slug', sa.String(length=255), nullable=True))
    ### end Alembic commands ###

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('user', 'slug')
    ### end Alembic commands ###


text:
require 'date'

#Enter name
def enter_name
	name = ""
	while name.empty?
		puts "Hello, What's your name?"
		name = gets.chomp.upcase
	end
	name
end

#Enter Name Action
name = enter_name
name.gsub!(/[^\w]/,"")
an_letters = "AEIOFHLMRSX"
name.each_char do |letter|
	article = an_letters.include?(letter) ? "an" : "a"
	puts "Give me #{article}... #{letter}!"
end
puts name + "'s just GRAND!"

#Record Birthday Action
puts "Hey #{name}, what's your birthday(M-D-Y)?"
birthday = Date.strptime(gets.chomp, '%m-%d-%Y').yday
now = DateTime.now.yday
diff = birthday - now
if diff < 0 && diff > -180
	puts "Awesome!  Your birthday was #{diff*-1} days ago! Happy Belated Birthday!"
	elsif diff < -180
		puts "Awesome!  Your birthday is in #{365-(diff*-1)} days! Happy Birthday in advance!"
	else puts "Awesome!  Your birthday is in #{diff} days! Happy Birthday in advance!"
end


text:
<?php

namespace Tests\AppBundle\Service;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;

abstract class AbstractServiceTest extends KernelTestCase
{
    /**
     * @var ContainerInterface
     */
    protected $container;

    protected function setUp()
    {
        static::bootKernel();

        $this->container =  static::$kernel->getContainer();
    }
}


text:
    <title>TREE.js</title>

					x: y:

					x: y:

				<input type="button" id="buttonid" value="saveObj" style="width:55px"onclick="saver()" style="position:absolute"  class="buttonb">
				<input type="button" id="buttonid" value="showCode" style="width:65px"onclick="activateAce()" style="position:absolute"class="buttonb">
				<input type="button" id="buttonid" value="runCode" style="width:55px"onclick="updateCode()" style="position:relative"class="buttonb">

			<select id="select" style="width:150px"class="buttonb" onChange="applyPreset()">
				<option value="1">sine wave simple</option>
				<option value="2">sine wave fractal</option>
				<option value="3">FunHouse Mirror</option>
				<option value="4">Spider</option>
				<option value="5">Radial Swirls</option>
				<option value="6">Furry Moth</option>
				<option value="7">Dancing Centipede</option>
				<option value="8">Stick Figure</option>
				<option value="9">Starfish</option>
				<option value="10">Starfish animating</option>
				<option value="11">Starfish stick</option>
				<option value="12">Starfish save images</option>
				<option value="13">Basics</option>
				<option value="13">Simple</option>
				<option value="13">Creature</option>
				<option value="13">Blobby Surface</option>
				<option value="13">Not an L-System</option>
				<option value="14">Sierpinski</option>
				<option value="15">Microphone Input</option>

			</select>

				<input type="button" id="buttonid" value="readMe" style="width:50px"onclick=""class="buttonb">


text:
We delay focus until mouse up if the mouse down occurs inside a focusable node that is inside an already focused node. But we shouldn't delay focus unless the mouse down occurs in an already focused node.  The text field below should be focused. To run manually, select everything from 'foo' though 'baz', then mouse down inside the text field.

foo
<input type="text" id="field">
baz