text:
package jsonschema

import (
	"encoding/json"
	"fmt"
	"strings"
)

type maximum struct {
	json.Number
	exclusive bool
}

func (m maximum) isLargerThanInt(n int64) (bool, error) {
	if !strings.Contains(m.String(), ".") {
		max, err := m.Int64()
		if err != nil {
			return false, err
		}
		return max > n || !m.exclusive && max == n, nil
	} else {
		return m.isLargerThanFloat(float64(n))
	}
}

func (m maximum) isLargerThanFloat(n float64) (isLarger bool, err error) {
	max, err := m.Float64()
	if err != nil {
		return
	}
	return max > n || !m.exclusive && max == n, nil
}

func (m *maximum) UnmarshalJSON(b []byte) error {
	return json.Unmarshal(b, &m.Number)
}

func (m *maximum) SetSchema(v map[string]json.RawMessage) error {
	value, ok := v["exclusiveMaximum"]
	if ok {
		// Ignore errors from Unmarshal. If exclusiveMaximum is a non boolean JSON
		// value we leave it as false.
		json.Unmarshal(value, &m.exclusive)
	}
	return nil
}

func (m maximum) Validate(keypath []string, v interface{}) []ValidationError {
	normalized, err := normalizeNumber(v)
	if err != nil {
		return []ValidationError{{keypath, err.Error()}}
	}
	var isLarger bool
	switch n := normalized.(type) {
	case int64:
		isLarger, err = m.isLargerThanInt(n)
	case float64:
		isLarger, err = m.isLargerThanFloat(n)
	default:
		return nil
	}
	if err != nil {
		return nil
	}
	if !isLarger {
		maxErr := fmt.Sprintf("Value must be smaller than %s.", m)
		return []ValidationError{{keypath, maxErr}}
	}
	return nil
}

type minimum struct {
	json.Number
	exclusive bool
}

func (m minimum) isLargerThanInt(n int64) (bool, error) {
	if !strings.Contains(m.String(), ".") {
		min, err := m.Int64()
		if err != nil {
			return false, nil
		}
		return min > n || !m.exclusive && min == n, nil
	} else {
		return m.isLargerThanFloat(float64(n))
	}
}

func (m minimum) isLargerThanFloat(n float64) (isLarger bool, err error) {
	min, err := m.Float64()
	if err != nil {
		return
	}
	return min > n || !m.exclusive && min == n, nil
}

func (m *minimum) UnmarshalJSON(b []byte) error {
	return json.Unmarshal(b, &m.Number)
}

func (m *minimum) SetSchema(v map[string]json.RawMessage) error {
	value, ok := v["exclusiveminimum"]
	if ok {
		// Ignore errors from Unmarshal. If exclusiveminimum is a non boolean JSON
		// value we leave it as false.
		json.Unmarshal(value, &m.exclusive)
	}
	return nil
}

func (m minimum) Validate(keypath []string, v interface{}) []ValidationError {
	normalized, err := normalizeNumber(v)
	if err != nil {
		return []ValidationError{{keypath, err.Error()}}
	}
	var isLarger bool
	switch n := normalized.(type) {
	case int64:
		isLarger, err = m.isLargerThanInt(n)
	case float64:
		isLarger, err = m.isLargerThanFloat(n)
	default:
		return nil
	}
	if err != nil {
		return nil
	}
	if isLarger {
		minErr := fmt.Sprintf("Value must be larger than %s.", m)
		return []ValidationError{{keypath, minErr}}
	}
	return nil
}

type multipleOf int64

func (m *multipleOf) UnmarshalJSON(b []byte) error {
	var n int64
	if err := json.Unmarshal(b, &n); err != nil {
		return err
	}
	*m = multipleOf(n)
	return nil
}

// Contrary to the spec, validation doesn't support floats in the schema
// or the data being validated. This is because of issues with math.Mod,
// e.g. math.Mod(0.0075, 0.0001) != 0.
func (m multipleOf) Validate(keypath []string, v interface{}) []ValidationError {
	normalized, err := normalizeNumber(v)
	if err != nil {
		return []ValidationError{{keypath, err.Error()}}
	}
	n, ok := normalized.(int64)
	if !ok {
		return nil
	}
	if n%int64(m) != 0 {
		mulErr := ValidationError{keypath, fmt.Sprintf("Value must be a multiple of %d.", m)}
		return []ValidationError{mulErr}
	}
	return nil
}


text:
namespace DiceLib
{
    /// <summary>
    ///     an interface for a Die with modifiers
    /// </summary>
    /// <typeparam name="T">
    ///     T can be anything but should probably be numeric <see cref="IRollableStatistics<T>" />
    /// </typeparam>
    public interface IDungeonDie<T> : IDie<T>, IRollableModified<T>
    {
    }
}

redpajama_set_name: RedPajamaGithub


text:
cask 'instasizer' do
  version :latest
  sha256 :no_check

  url 'http://www.tapgods.com/instasizer/Instasizer.zip'
  name 'Instasizer'
  homepage 'http://www.tapgods.com/instasizer/'

  depends_on macos: '>= :lion'

  app 'Instasizer.app'
end


text:
package com.inepex.translatorapp.server.entity.dao;

import java.util.Iterator;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.NonUniqueResultException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.inepex.ineForm.server.BaseDao;
import com.inepex.ineForm.server.BaseQuery;
import com.inepex.ineForm.server.CriteriaSelector;
import com.inepex.ineForm.shared.BaseMapper;
import com.inepex.ineForm.shared.dispatch.ManipulationObjectFactory;
import com.inepex.ineom.shared.AssistedObjectHandlerFactory;
import com.inepex.ineom.shared.descriptorstore.DescriptorStore;
import com.inepex.translatorapp.server.entity.Lang;
import com.inepex.translatorapp.server.entity.Module;
import com.inepex.translatorapp.server.entity.ModuleLang;
import com.inepex.translatorapp.server.entity.ModuleRow;
import com.inepex.translatorapp.server.entity.Module_;
import com.inepex.translatorapp.server.entity.TranslatedValue;
import com.inepex.translatorapp.server.entity.User;
import com.inepex.translatorapp.server.entity.dao.query.ModuleQuery;
import com.inepex.translatorapp.server.entity.mapper.ModuleMapper;

/**
 * Just generated once, don't need to regenerate after modifying attributes!
 *
 * To customize persist, merge or remove behaviour override persist(E), merge(E)
 * or remove(E). (Don't forget to call super.persist, super.merge ...)
 *
 */
@Singleton
public class ModuleDao extends BaseDao<Module> {

    private static final Logger _logger = LoggerFactory.getLogger(ModuleDao.class);

    private final DescriptorStore descStore;

    @Inject
    public ModuleDao(
        Provider<EntityManager> em,
        ManipulationObjectFactory objectFactory,
        AssistedObjectHandlerFactory handlerFactory,
        DescriptorStore descStore) {
        super(em, objectFactory, handlerFactory);
        this.descStore = descStore;
    }

    @Override
    public BaseQuery<Module> getQuery() {
        return new ModuleQuery(descStore);
    }

    @Override
    public BaseMapper<Module> getMapper() {
        return new ModuleMapper(descStore);
    }

    @Override
    public CriteriaSelector<Module, Module> getSelector() {
        return new CriteriaSelector<Module, Module>(em, getQuery(), Module.class, Module.class);
    }

    @Override
    public CriteriaSelector<Long, Module> getCountSelector() {
        return new CriteriaSelector<Long, Module>(em, getQuery(), Long.class, Module.class);
    }

    @Override
    public Class<Module> getClazz() {
        return Module.class;
    }

    @Override
    public Module newInstance() {
        return new Module();
    }

    public void removeLang(Long langId, Long moduleId) {
        if (langId == null || moduleId == null)
            throw new IllegalArgumentException();

        Module module = findById(moduleId);

        Iterator<ModuleLang> mlIterator = module.getLangs().iterator();
        while (mlIterator.hasNext()) {
            ModuleLang ml = mlIterator.next();
            if (ml.getLang().getId().equals(langId)) {
                mlIterator.remove();
                break;
            }
        }

        for (ModuleRow mr : module.getRows()) {
            Iterator<TranslatedValue> tvIterator = mr.getValues().iterator();
            while (tvIterator.hasNext()) {
                TranslatedValue tv = tvIterator.next();
                if (tv.getLang().getId().equals(langId)) {
                    tvIterator.remove();
                    break;
                }
            }
        }

        mergeTrans(module);
    }

    public void addLang(Long langId, Long moduleId, Long userId) {
        if (userId == null || langId == null || moduleId == null)
            throw new IllegalArgumentException();

        Module module = findById(moduleId);
        ModuleLang ml = new ModuleLang();
        ml.setModule(module);
        ml.setLang(new Lang(langId));
        module.getLangs().add(ml);

        long now = System.currentTimeMillis();
        for (ModuleRow mr : module.getRows()) {
            TranslatedValue tv = new TranslatedValue();
            tv.setLang(new Lang(langId));
            tv.setLastModTime(now);
            tv.setLastModUser(new User(userId));
            tv.setValue("");
            tv.setRow(mr);

            mr.getValues().add(tv);
        }

        mergeTrans(module);
    }

    public Module findByName(String moduleName) {
        CriteriaSelector<Module, Module> sel = getSelector();

        sel.cq.select(sel.root);
        sel.cq.from(Module.class);
        sel.cq.where(sel.cb.equal(sel.root.get(Module_.name), moduleName));
        sel.cq.distinct(true);

        try {
            Module u = sel.getTypedQuery().getSingleResult();
            em.get().refresh(u);
            return u;
        } catch (NoResultException ex) {
            return null;
        } catch (NonUniqueResultException ex) {
            _logger.error("No unique result:", ex);
            return null;
        }
    }

    /* hc:customMethods */
    // overrides and custom methods
    /* hc */

}


text:
#ifndef VICE_C64PARALLEL_H
#define VICE_C64PARALLEL_H

#include "types.h"

extern void parallel_cable_cpu_execute(int type);
extern void parallel_cable_cpu_write(int type, BYTE data);
extern void parallel_cable_cpu_pulse(int type);
extern BYTE parallel_cable_cpu_read(int type);
extern void parallel_cable_cpu_undump(int type, BYTE data);

#endif


text:
using Xunit;

public class ProverbTest
{
    [Fact]
    public void Line_one()
    {
        Assert.Equal("For want of a nail the shoe was lost.", Proverb.Line(1));
    }

    [Fact(Skip = "Remove to run test")]
    public void Line_four()
    {
        Assert.Equal("For want of a rider the message was lost.", Proverb.Line(4));
    }

    [Fact(Skip = "Remove to run test")]
    public void Line_seven()
    {
        Assert.Equal("And all for the want of a horseshoe nail.", Proverb.Line(7));
    }

    [Fact(Skip = "Remove to run test")]
    public void All_lines()
    {
        const string expected = "For want of a nail the shoe was lost.\n" +
                                "For want of a shoe the horse was lost.\n" +
                                "For want of a horse the rider was lost.\n" +
                                "For want of a rider the message was lost.\n" +
                                "For want of a message the battle was lost.\n" +
                                "For want of a battle the kingdom was lost.\n" +
                                "And all for the want of a horseshoe nail.";

        Assert.Equal(expected, Proverb.AllLines());
    }
}


text:
This GameEngine is based on a tutorial series and is a great introduction for beginners to OpenGL since I teach the basic concepts.
Following aspects can be learned:
  - Modern OpenGL
  - Object Oriented Programming concepts for OpenGL
  - Basic GameEngine features (e.g., Phyiscs, Shading and Component-Based Entity Systems)

## Features:

  - Opening a Window and setting its Clear-Color
  - Shader Class
    - A way to load and handle shaders
    - This class registers uniform variables on their own
    - If the "Bind(shaderObj)" macro is used, the shader is automatically unbind after the scope it was bind to.

# Dependencies

 - SDL2
 - GLM
 - OpenGL
 - GLEW

# Development

Want to use this engine? Great!

The project files for VisualStudio (2015) are included in this repository. For a more detailled explaination see this [video][devVid].

You may want to use other IDEs or Compilers; Therefore, add the Dependencies (listed above) to the linker and have fun.

# Todos

 - Write automated tests
 - Add samples for each component of the engine
 - Input Handler
   - Handle Key and Button inputs
 - Assets Loader
   - We need a way to load all kinds of stuff with only one loader
   - Lets code a Asset Loader to store and load shaders, textures and models
 - Component based entity system
   - A system to handle entities and their components
 - Scene Handler
   - We need a way to handle different scenes
   - Extract main function into the game project where the scenes are registered and than the main loop is called
 - GUI
   - A way to create a GUI for games
   - We need:
     - Text/Font-Handler
   - Window Handler
   - Event Handler
   - Image Handler
 - Add Deferred Shading
   - A method that simulates light and shadow casts
 - (3D Object MipMapping)

License
----

MIT

[devVid]: <https://www.youtube.com/watch?v=BYON4cKbxSc>