text:
// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

'use strict';

/**
 * Request/Response classes to marshal an wam.binding.fs.ExecuteContext over a
 * wam channel.
 */
wam.remote.fs.execute = {};

wam.remote.fs.execute.Request = function(handshakeRequest, executeContext) {
  this.handshakeRequest = handshakeRequest;
  this.executeContext = executeContext;

  this.readyRequest = new wam.remote.ready.Request(executeContext);
  this.readyRequest.onMessage.addListener(this.onMessage_.bind(this));

  executeContext.dependsOn(handshakeRequest.readyRequest.readyBinding);
  executeContext.onExecute.addListener(this.onExecute_.bind(this));
  executeContext.onTTYChange.addListener(this.onTTYChange_.bind(this));
  executeContext.onStdIn.addListener(this.onStdIn_.bind(this));
  executeContext.onSignal.addListener(this.onSignal_.bind(this));
};

wam.remote.fs.execute.Request.prototype.onExecute_ = function() {
  var outMessage = this.handshakeRequest.readyRequest.createMessage(
      'execute',
      {'path': this.executeContext.path,
       'execArg': this.executeContext.arg,
       'execEnv': this.executeContext.env_,
       'tty': this.executeContext.tty_
      });

  this.readyRequest.sendRequest(outMessage);
};

wam.remote.fs.execute.Request.prototype.onStdIn_ = function(value) {
  this.readyRequest.send('stdin', value);
};

wam.remote.fs.execute.Request.prototype.onSignal_ = function(name) {
  this.readyRequest.send('signal', name);
};

wam.remote.fs.execute.Request.prototype.onTTYChange_ = function(tty) {
  if (this.readyRequest.readyBinding.isOpen)
    this.readyRequest.send('tty-change', tty);
};

wam.remote.fs.execute.Request.prototype.onMessage_ = function(inMessage) {
  if (inMessage.name == 'stdout' || inMessage.name == 'stderr') {
    var onAck = null;
    if (inMessage.isOpen) {
      onAck = function(value) {
        inMessage.replyOk(typeof value == 'undefined' ? null : value);
      };
    }

    if (inMessage.name == 'stdout') {
      this.executeContext.stdout(inMessage.arg, onAck);
    } else {
      this.executeContext.stderr(inMessage.arg, onAck);
    }

  } else if (inMessage.name == 'tty-request') {
    this.executeContext.requestTTY(inMessage.arg);

  } else if (inMessage.name != 'stdout' && inMessage.name != 'stderr' &&
             !inMessage.isFinalReply) {
    console.warn('remote execute request received unexpected message: ' +
                 inMessage.name, inMessage.arg);
    if (inMessage.isOpen) {
      inMessage.replyError('wam.UnexpectedMessage',
                           [inMessage.name, inMessage.arg]);
    }
  }
};

/**
 *
 */
wam.remote.fs.execute.Response = function(inMessage, executeContext) {
  this.inMessage = inMessage;

  this.executeContext = executeContext;
  this.executeContext.onStdOut.addListener(this.onStdOut_, this);
  this.executeContext.onStdErr.addListener(this.onStdErr_, this);
  this.executeContext.onTTYRequest.addListener(this.onTTYRequest_.bind(this));

  this.readyResponse = new wam.remote.ready.Response(inMessage, executeContext);
  this.readyResponse.onMessage.addListener(this.onMessage_.bind(this));
};

wam.remote.fs.execute.Response.prototype.onMessage_ = function(inMessage) {
  switch (inMessage.name) {
    case 'stdin':
      var onAck = null;
      if (inMessage.isOpen) {
        onAck = function(value) {
          inMessage.replyOk(typeof value == 'undefined' ? null : value);
        };
      }

      this.executeContext.stdin(inMessage.arg, onAck);
      break;

    case 'tty-change':
      this.executeContext.setTTY(inMessage.arg);
      break;

    case 'signal':
      this.executeContext.signal(inMessage.arg.name, inMessage.arg.value);
      break;
  }
};

wam.remote.fs.execute.Response.prototype.onTTYRequest_ = function(value) {
  this.readyResponse.send('tty-request', value);
};

wam.remote.fs.execute.Response.prototype.onStdOut_ = function(value, onAck) {
  this.readyResponse.send('stdout', value,
                          (onAck ?
                           function(inMessage) { onAck(inMessage.arg) } :
                           null));
};

wam.remote.fs.execute.Response.prototype.onStdErr_ = function(value, onAck) {
  this.readyResponse.send('stderr', value,
                          (onAck ?
                           function(inMessage) { onAck(inMessage.arg) } :
                           null));
};


text:
package com.example.weathertestdemo.model;

public class Weather {
	private String cityName;
	private String publishTime;
	private String currentDate;
	private String weatherInfo;
	private String realTemp;
	private String week;

	private String today;
	private String infoWeather;
	private String min;
	private String max;

	private String day1;
	private String infoWeather1;
	private String min1;
	private String max1;

	private String day2;
	private String infoWeather2;
	private String min2;
	private String max2;

	private String day3;
	private String infoWeather3;
	private String min3;
	private String max3;

	private String day4;
	private String infoWeather4;
	private String min4;
	private String max4;

	public Weather() {

	}

	public Weather(String cityName, String publishTime, String currentDate,
			String weatherInfo, String realTemp, String week,
			String today, String infoWeather, String min, String max,
			String day1, String infoWeather1, String min1, String max1,
			String day2, String infoWeather2, String min2, String max2,
			String day3, String infoWeather3, String min3, String max3,
			String day4, String infoWeather4, String min4, String max4) {
		super();
		this.cityName = cityName;
		this.publishTime = publishTime;
		this.currentDate = currentDate;
		this.weatherInfo = weatherInfo;
		this.realTemp = realTemp;
		this.week = week;
		this.today = today;
		this.infoWeather = infoWeather;
		this.min = min;
		this.max = max;
		this.day1 = day1;
		this.infoWeather1 = infoWeather1;
		this.min1 = min1;
		this.max1 = max1;
		this.day2 = day2;
		this.infoWeather2 = infoWeather2;
		this.min2 = min2;
		this.max2 = max2;
		this.day3 = day3;
		this.infoWeather3 = infoWeather3;
		this.min3 = min3;
		this.max3 = max3;
		this.day4 = day4;
		this.infoWeather4 = infoWeather4;
		this.min4 = min4;
		this.max4 = max4;
	}

	public String getToday() {
		return today;
	}

	public void setToday(String today) {
		this.today = today;
	}

	public String getInfoWeather() {
		return infoWeather;
	}

	public void setInfoWeather(String infoWeather) {
		this.infoWeather = infoWeather;
	}

	public String getMin() {
		return min;
	}

	public void setMin(String min) {
		this.min = min;
	}

	public String getMax() {
		return max;
	}

	public void setMax(String max) {
		this.max = max;
	}

	public String getDay1() {
		return day1;
	}

	public void setDay1(String day1) {
		this.day1 = day1;
	}

	public String getInfoWeather1() {
		return infoWeather1;
	}

	public void setInfoWeather1(String infoWeather1) {
		this.infoWeather1 = infoWeather1;
	}

	public String getMin1() {
		return min1;
	}

	public void setMin1(String min1) {
		this.min1 = min1;
	}

	public String getMax1() {
		return max1;
	}

	public void setMax1(String max1) {
		this.max1 = max1;
	}

	public String getDay2() {
		return day2;
	}

	public void setDay2(String day2) {
		this.day2 = day2;
	}

	public String getInfoWeather2() {
		return infoWeather2;
	}

	public void setInfoWeather2(String infoWeather2) {
		this.infoWeather2 = infoWeather2;
	}

	public String getMin2() {
		return min2;
	}

	public void setMin2(String min2) {
		this.min2 = min2;
	}

	public String getMax2() {
		return max2;
	}

	public void setMax2(String max2) {
		this.max2 = max2;
	}

	public String getDay3() {
		return day3;
	}

	public void setDay3(String day3) {
		this.day3 = day3;
	}

	public String getInfoWeather3() {
		return infoWeather3;
	}

	public void setInfoWeather3(String infoWeather3) {
		this.infoWeather3 = infoWeather3;
	}

	public String getMin3() {
		return min3;
	}

	public void setMin3(String min3) {
		this.min3 = min3;
	}

	public String getMax3() {
		return max3;
	}

	public void setMax3(String max3) {
		this.max3 = max3;
	}

	public String getDay4() {
		return day4;
	}

	public void setDay4(String day4) {
		this.day4 = day4;
	}

	public String getInfoWeather4() {
		return infoWeather4;
	}

	public void setInfoWeather4(String infoWeather4) {
		this.infoWeather4 = infoWeather4;
	}

	public String getMin4() {
		return min4;
	}

	public void setMin4(String min4) {
		this.min4 = min4;
	}

	public String getMax4() {
		return max4;
	}

	public void setMax4(String max4) {
		this.max4 = max4;
	}

	public String getWeek() {
		return week;
	}

	public void setWeek(String week) {
		this.week = week;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public String getPublishTime() {
		return publishTime;
	}

	public void setPublishTime(String publishTime) {
		this.publishTime = publishTime;
	}

	public String getCurrentDate() {
		return currentDate;
	}

	public void setCurrentDate(String currentDate) {
		this.currentDate = currentDate;
	}

	public String getWeatherInfo() {
		return weatherInfo;
	}

	public void setWeatherInfo(String weatherInfo) {
		this.weatherInfo = weatherInfo;
	}

	public String getRealTemp() {
		return realTemp;
	}

	public void setRealTemp(String realTemp) {
		this.realTemp = realTemp;
	}

}

redpajama_set_name: RedPajamaGithub


text:
class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :email
      t.text :password_digest
      t.timestamps
    end
  end
end


text:
package nl.knaw.dans.rs.aggregator.sync;

import nl.knaw.dans.rs.aggregator.schedule.Job;
import nl.knaw.dans.rs.aggregator.syncore.ResourceManager;
import nl.knaw.dans.rs.aggregator.syncore.SitemapConverterProvider;
import nl.knaw.dans.rs.aggregator.syncore.Sync;
import nl.knaw.dans.rs.aggregator.syncore.SyncPostProcessor;
import nl.knaw.dans.rs.aggregator.syncore.VerificationPolicy;
import nl.knaw.dans.rs.aggregator.util.NormURI;
import nl.knaw.dans.rs.aggregator.syncore.PathFinder;
import nl.knaw.dans.rs.aggregator.util.RsProperties;
import nl.knaw.dans.rs.aggregator.xml.ResourceSyncContext;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;

/**
 * Created on 2017-05-03 17:05.
 */
public class SyncJob implements Job {

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

  private CloseableHttpClient httpClient;
  private ResourceSyncContext rsContext;

  private SitemapConverterProvider sitemapConverterProvider;
  private VerificationPolicy verificationPolicy;
  private ResourceManager resourceManager;

  private SitemapCollector sitemapCollector;
  private SyncPostProcessor syncPostProcessor;

  private String uriListLocation;
  private String baseDirectory;

  public SitemapConverterProvider getSitemapConverterProvider() {
    if (sitemapConverterProvider == null) {
      sitemapConverterProvider = new FsSitemapConverterProvider();
    }
    return sitemapConverterProvider;
  }

  public void setSitemapConverterProvider(SitemapConverterProvider sitemapConverterProvider) {
    this.sitemapConverterProvider = sitemapConverterProvider;
  }

  public VerificationPolicy getVerificationPolicy() {
    if (verificationPolicy == null) {
      verificationPolicy = new DefaultVerificationPolicy();
    }
    return verificationPolicy;
  }

  public void setVerificationPolicy(VerificationPolicy verificationPolicy) {
    logger.debug("Verification policy: {}", verificationPolicy);
    this.verificationPolicy = verificationPolicy;
  }

  public ResourceManager getResourceManager() {
    if (resourceManager == null) {
      resourceManager = new FsResourceManager();
    }
    return resourceManager;
  }

  public void setResourceManager(ResourceManager resourceManager) {
    logger.debug("Resource manager: {}", resourceManager);
    this.resourceManager = resourceManager;
  }

  public SyncPostProcessor getSyncPostProcessor() {
    if (syncPostProcessor == null) {
      syncPostProcessor = new DefaultSyncPostProcessor();
    }
    return syncPostProcessor;
  }

  public void setSyncPostProcessor(SyncPostProcessor syncPostProcessor) {
    this.syncPostProcessor = syncPostProcessor;
  }

  public CloseableHttpClient getHttpClient() {
    if (httpClient == null) {
      httpClient = HttpClients.createDefault();
    }
    return httpClient;
  }

  public void setHttpClient(CloseableHttpClient httpClient) {
    this.httpClient = httpClient;
  }

  public ResourceSyncContext getRsContext() {
    if (rsContext == null) {
      try {
        rsContext = new ResourceSyncContext();
      } catch (JAXBException e) {
        throw new RuntimeException(e);
      }
    }
    return rsContext;
  }

  public void setRsContext(ResourceSyncContext rsContext) {
    this.rsContext = rsContext;
  }

  public SitemapCollector getSitemapCollector() {
    if (sitemapCollector == null) {
      sitemapCollector = new SitemapCollector();
    }
    return sitemapCollector;
  }

  public void setSitemapCollector(SitemapCollector sitemapCollector) {
    this.sitemapCollector = sitemapCollector;
  }

  public String getUriListLocation() {
    if (uriListLocation == null) {
      throw new IllegalStateException("No urilist set");
    }
    return uriListLocation;
  }

  public void setUriListLocation(String uriListLocation) {
    this.uriListLocation = uriListLocation;
  }

  public String getBaseDirectory() {
    if (baseDirectory == null) {
      baseDirectory = "base-directory";
    }
    return baseDirectory;
  }

  public void setBaseDirectory(String baseDirectory) {
    this.baseDirectory = baseDirectory;
  }

  public void readListAndSynchronize() throws Exception {
    List<URI> uriList = new ArrayList<>();
    Scanner scanner = new Scanner(new File(getUriListLocation()));
    while (scanner.hasNextLine()) {
      String uriString = scanner.nextLine();
      Optional<URI> maybeUri = NormURI.normalize(uriString);
      if (maybeUri.isPresent()) {
        uriList.add(maybeUri.get());
      } else {
        logger.warn("Unable to convert {} to a URI", uriString);
      }
    }
    synchronize(uriList);
  }

  public void synchronize(List<URI> uriList) throws Exception {
    SitemapConverterProvider sitemapConverterProvider = getSitemapConverterProvider()
      .withResourceSyncContext(getRsContext());
    SitemapCollector sitemapCollector = getSitemapCollector()
      .withHttpClient(getHttpClient())
      .withRsContext(getRsContext())
      .withConverter(sitemapConverterProvider.getConverter());
    SyncWorker syncWorker = new SyncWorker()
      .withSitemapCollector(sitemapCollector)
      .withVerificationPolicy(getVerificationPolicy())
      .withResourceManager(getResourceManager());
    SyncPostProcessor syncPostProcessor = getSyncPostProcessor();

    for (URI uri : uriList) {
      PathFinder pathFinder = new PathFinder(getBaseDirectory(), uri);
      RsProperties currentSyncProps = new RsProperties();
      setLatestSyncRun(pathFinder, sitemapCollector);

      sitemapConverterProvider.setPathFinder(pathFinder);
      syncWorker.synchronize(pathFinder, currentSyncProps);
      syncPostProcessor.postProcess(sitemapCollector.getCurrentIndex(), pathFinder, currentSyncProps);
    }
  }

  private void setLatestSyncRun(PathFinder pathFinder, SitemapCollector sitemapCollector) {
    File prevSyncPropFile = pathFinder.getPrevSyncPropXmlFile();
    ZonedDateTime latestSyncRun = null;
    if (prevSyncPropFile != null) {
      RsProperties prevSyncProps = new RsProperties();
      try {
        prevSyncProps.loadFromXML(prevSyncPropFile);
        latestSyncRun = prevSyncProps.getDateTime(Sync.PROP_SW_SYNC_START);
      } catch (IOException e) {
        throw new RuntimeException("Could not load syncProps from " + prevSyncPropFile, e);
      }
    }
    sitemapCollector.withAsOfDateTime(latestSyncRun);
    logger.info("only looking at item-events after {}", sitemapCollector.getAsOfDateTime());
  }

  @Override
  public void execute() throws Exception {
    readListAndSynchronize();
  }
}


text:
require File.expand_path("../../test_helper", __FILE__)

class HostNetworkInterfaceTest < Test::Unit::TestCase
  setup do
    @interface = mock("interface")
    @parent = mock("parent")

    @klass = VirtualBox::HostNetworkInterface
  end

  context "class methods" do
    context "populating relationships" do
      setup do
        @instance = mock("instance")

        @interface.stubs(:network_interfaces).returns([])
        @klass.stubs(:new).returns(@instance)
      end

      should "return a proxied collection" do
        result = @klass.populate_relationship(nil, @interface)
        assert result.is_a?(VirtualBox::Proxies::Collection)
      end

      should "call new for every interface" do
        collection = []
        @interface.stubs(:network_interfaces).returns(collection)
        5.times { |i| collection << mock("a#{i}") }

        expected_result = []
        new_seq = sequence("new_seq")
        collection.each do |item|
          expected_value = "instance-#{item.inspect}"
          @klass.expects(:new).with(item).in_sequence(new_seq).returns(expected_value)
          expected_result << expected_value
        end

        assert_equal expected_result, @klass.populate_relationship(@parent, @interface)
      end
    end

    context "creating" do
      setup do
        @interface = mock("interface")
        @inet = mock("inet")
        @progress = mock("progress")
      end

      should "create and return new instance" do
        result = mock("result")
        @interface.expects(:create_host_only_network_interface).returns([@inet, @progress]).once
        @progress.expects(:wait)
        @klass.expects(:new).with(@inet).returns(result)

        assert_equal result, @klass.create(nil, @interface)
      end
    end
  end

  context "initializing" do
    should "load attributes from the machine" do
      @klass.any_instance.expects(:initialize_attributes).with(@interface).once
      @klass.new(@interface)
    end
  end

  context "initializing attributes" do
    setup do
      @klass.any_instance.stubs(:load_interface_attributes)
    end

    should "load interface attribtues" do
      @klass.any_instance.expects(:load_interface_attributes).with(@interface).once
      @klass.new(@interface)
    end

    should "be existing record" do
      @instance = @klass.new(@interface)
      assert !@instance.new_record?
    end
  end

  context "instance methods" do
    setup do
      @klass.any_instance.stubs(:initialize_attributes)

      @parent = mock("parent")
      @interface = mock("interface")
      @instance = @klass.new(@interface)
      @instance.stubs(:interface).returns(@interface)
      @instance.stubs(:parent).returns(@parent)
      @collection = VirtualBox::Proxies::Collection.new(@parent)
      @collection << @instance
    end

    context "attached VMs" do
      setup do
        @parent_parent = mock("parentparent")
        @parent.stubs(:parent).returns(@parent_parent)

        @vms = []
        @parent_parent.stubs(:vms).returns(@vms)
      end

      def stub_vm(*interfaces)
        adapters = []
        vm = mock("vm")
        vm.stubs(:accessible?).returns(true)
        vm.stubs(:network_adapters).returns(adapters)

        interfaces.each do |name|
          adapter = mock("adapter")
          adapter.stubs(:enabled?).returns(true)
          adapter.stubs(:host_only_interface).returns(name)
          adapters << adapter
        end

        vm
      end

      should "return no VMs if none are using the interface" do
        assert @instance.attached_vms.empty?
      end

      should "return only the VMs which are using the interface" do
        name = "foo"
        @instance.stubs(:name).returns(name)
        result = stub_vm(name)
        @vms << stub_vm("bar")
        @vms << result
        @vms << stub_vm("baz")

        assert_equal [result], @instance.attached_vms
      end
    end

    context "dhcp server" do
      setup do
        @host = mock("host")
        @dhcp_servers = []
        @parent.stubs(:parent).returns(@host)
        @host.stubs(:dhcp_servers).returns(@dhcp_servers)
        @instance.stubs(:interface_type).returns(:host_only)

        @name = "foo"
        @instance.stubs(:name).returns(@name)
      end

      def stub_dhcp_server(name, prefix=true)
        name = "HostInterfaceNetworking-#{name}" if prefix

        dhcp = mock("dhcp")
        dhcp.stubs(:network_name).returns(name)
        dhcp
      end

      should "return nil if interface type isn't host only" do
        @instance.stubs(:interface_type).returns(:bridged)
        assert_nil @instance.dhcp_server
      end

      should "return the DHCP server if it finds one" do
        server = stub_dhcp_server(@name)
        @dhcp_servers << server
        assert_equal server, @instance.dhcp_server
      end

      should "create a DHCP server if it can't find one" do
        result = mock("result")
      end

      should "not create a DHCP if specified and not found" do
        @dhcp_servers.expects(:create).never
        assert_nil @instance.dhcp_server(false)
      end
    end

    context "enabling static IPV4" do
      setup do
        @interface.stubs(:enable_static_ip_config)
        @instance.stubs(:reload)
      end

      should "enable the ip config" do
        ip = :foo
        netmask = :bar
        @interface.expects(:enable_static_ip_config).with(ip, netmask).once
        @instance.enable_static(ip, netmask)
      end

      should "by default use the current network mask" do
        ip = :foo
        @interface.expects(:enable_static_ip_config).with(ip, @instance.network_mask).once
        @instance.enable_static(ip)
      end

      should "reload the instance" do
        result = mock("result")
        @instance.expects(:reload).returns(result)
        assert_equal result, @instance.enable_static(:foo)
      end
    end

    context "reloading" do
      setup do
        @interface = mock("parent_interface")
        @parent.stubs(:interface).returns(@interface)
      end

      should "reload based on the interface found by the parent" do
        result = mock("result")
        @interface.expects(:find_host_network_interface_by_id).with(@instance.uuid).once.returns(result)
        @instance.expects(:initialize_attributes).with(result).once
        assert_equal @instance, @instance.reload
      end
    end

    context "destroying" do
      setup do
        @interface = mock("parent_interface")
        @progress = mock("progress")
        @progress.stubs(:wait)
        @parent.stubs(:interface).returns(@interface)
        @interface.stubs(:remove_host_only_network_interface).returns(@progress)
        @instance.stubs(:dhcp_server).returns(nil)
        @instance.stubs(:interface_type).returns(:host_only)
      end

      should "do nothing if bridged" do
        @instance.stubs(:interface_type).returns(:bridged)
        @interface.expects(:remove_host_only_network_interface).never
        assert !@instance.destroy
      end

      should "remove the network interface from VirtualBox" do
        @interface.expects(:remove_host_only_network_interface).with(@instance.uuid).returns(@progress)

        @instance.destroy
      end

      should "destroy the DHCP server if it exists" do
        server = mock("server")
        @instance.stubs(:dhcp_server).returns(server)
        server.expects(:destroy).once

        @instance.destroy
      end

      should "remove the instance from it's collection" do
        assert @collection.include?(@instance)
        @instance.destroy
        assert !@collection.include?(@instance)
      end
    end
  end
end


text:
<!DOCTYPE html>

        <title>List of request</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <link rel="icon" href="favicon.ico" type="image/x-icon" />

        <link rel="stylesheet" type="text/css" id="theme" href="css/theme-default.css"/>

Home

Request

List of Requests:

                                                    Name:
                                                    Message
                                                    Accept
                                                    Reject

                                                    {{q.name}}
                                                    {{q.message}}

<button ng-click="acceptPerson(q.eventName,q.targetTeam,q.memberName)" class="btn btn-info btn-rounded">Accept</button>

<button ng-click="rejectPerson(q.eventName,q.targetTeam,q.memberName)" class="btn btn-info btn-rounded">Reject</button>


text:
    public class MyCRMService : CRMService
    {
        public void Example()
        {
            // CRM Service
            service.Execute(blah);
        }
    }

### Add Services

    services.AddCrm(connectionString);

### Use Service

    var myService = Services.GetService<MyService>();


text:
from dateutil.tz import tzlocal
import datetime
import os
import unittest

from mldb import mldb, MldbUnitTest, ResponseException

class ContinuousWindowDsIssueTest(MldbUnitTest):  # noqa

    def test_it(self):
        create_storage_js = """
        var config = { type: "beh.binary.mutable" };
        var dataset = mldb.createDataset(config);
        var output = { config: dataset.config() };
        output;
        """

        save_storage_js = """
        var uri = "file://tmp/MLDBFB-530-" + new Date().toISOString() + ".beh";
        var addr = "/v1/datasets/" + args.datasetId;
        var res = mldb.post(addr + "/routes/saves", { dataFileUrl: uri });
        var output = { metadata: mldb.get(addr).json.status, config: res.json};
        output;
        """

        filename = 'tmp/MLDBFB-530-metadata.sqlite'
        try:
            os.mkdir('tmp')
        except OSError:
            # file exists
            try:
                os.unlink(filename)
            except OSError:
                # file doesn't exist
                pass

        mldb.post('/v1/datasets', {
            "id": "recorder",
            "type": "continuous",
            "params": {
                "commitInterval": "0s",
                "metadataDataset": {
                    "type": "sqliteSparse",
                    "id": "metadataDb",
                    "params": {
                        "dataFileUrl": "file://" + filename
                    }
                },
                "createStorageDataset": {
                    "type": "script.run",
                    "params": {
                        "language": "javascript",
                        "scriptConfig": {
                            "source": create_storage_js
                        }
                    }
                },
                "saveStorageDataset": {
                    "type": "script.run",
                    "params": {
                        "language": "javascript",
                        "scriptConfig": {
                            "source": save_storage_js
                        }
                    }
                }
            }
        })

        mldb.post('/v1/datasets/recorder/rows', {
            'rowName' : 'row1',
            'columns' : [['colA', 1, datetime.datetime.now(tzlocal()).isoformat()]]
        })

        datasets = mldb.get('/v1/datasets').json()
        mldb.post('/v1/datasets/recorder/commit')

        mldb.log(mldb.query("SELECT * FROM metadataDb"))

        for ds in datasets:
            if ds not in ['metadataDb', 'recorder']:
                # This simulates the restart of mldb. (The previously commited
                # dataset is no longer loaded.) If you remove it, the test
                # works.
                mldb.delete('/v1/datasets/' + ds)

        # At the moment of creating this test, this call fails with
        # Error initializing continuous window dataset in metadata query:
        # Attempt to refer to nonexistant dataset with id
        # auto-ece4a39e4e8ee8bc-1d16ff0d5362be47
        # (Of course the id is random.)
        mldb.post("/v1/datasets", {
            'id' : 'window',
            "type": "continuous.window",
            "params": {
                "metadataDataset" : {
                    "id": 'metadataDb',
                    "params": {
                        "dataFileUrl": "file://" + filename
                    }
                },
                'from' : '1980-01-01T00:00:00Z',
                'to' : '3020-01-01T00:00:00Z'
            }
        })

        res = mldb.query("SELECT * FROM window")
        self.assertEqual(res[1:], [["row1", 1]])

if __name__ == '__main__':
    mldb.run_tests()


text:
layout: page
title: Chase Systems Seminar
date: 2016-05-24
author: Dorothy Browning
tags: weekly links, java
status: published
summary: Sed ac velit sodales, mattis mi vel.
banner: images/banner/leisure-02.jpg
booking:
  startDate: 05/10/2016
  endDate: 05/12/2016
  ctyhocn: LASHNHX
  groupCode: CSS
published: true
---
Proin hendrerit malesuada ultricies. Aliquam pretium erat eu rutrum bibendum. Praesent condimentum nisl tempus, placerat nisl a, dapibus diam. Morbi ante nisl, venenatis in porttitor ut, tincidunt dapibus felis. Vestibulum dictum gravida velit, a bibendum libero elementum quis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut purus mauris, laoreet vel cursus luctus, aliquet quis nunc. Aliquam facilisis nisi id placerat auctor. Aenean non nisi ac nisi semper sollicitudin ut sed ligula.

* Fusce eu arcu vitae felis varius mollis ut eget lacus
* Quisque at purus eu augue consequat rhoncus et non nunc.

Nam in turpis nibh. Maecenas gravida, arcu ut ullamcorper faucibus, nunc metus tristique metus, vitae hendrerit dui nunc sit amet felis. Proin et ipsum odio. Cras ornare, sapien quis posuere dapibus, lorem ipsum porttitor dolor, ac rutrum arcu nulla ac turpis. Phasellus condimentum metus vel scelerisque porttitor. Mauris elementum vel libero sed pulvinar. Integer ultrices efficitur felis quis tempus. Quisque laoreet eros at libero euismod, eu varius sapien laoreet. In hac habitasse platea dictumst.


text:
const shell = require("gulp-shell");
const gutil = require("gulp-util");

module.exports = (gulp) => {
  gulp.task('latex2pdf', shell.task([
    'bash lib/pdf_all.sh > /dev/null',
  ]));

  gulp.task('compile', gulp.series('latex2pdf'), () => {
    gutil.log('🖨  Change detected, recompiling!');
  });
};


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.media.videoanalyzer.edge.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** A list of ONVIF devices that were discovered in the same subnet as the IoT Edge device. */
@Fluent
public final class DiscoveredOnvifDeviceCollection {
    /*
     * An array of ONVIF devices that have been discovered in the same subnet
     * as the IoT Edge device.
     */
    @JsonProperty(value = "value")
    private List<DiscoveredOnvifDevice> value;

    /**
     * Get the value property: An array of ONVIF devices that have been discovered in the same subnet as the IoT Edge
     * device.
     *
     * @return the value value.
     */
    public List<DiscoveredOnvifDevice> getValue() {
        return this.value;
    }

    /**
     * Set the value property: An array of ONVIF devices that have been discovered in the same subnet as the IoT Edge
     * device.
     *
     * @param value the value value to set.
     * @return the DiscoveredOnvifDeviceCollection object itself.
     */
    public DiscoveredOnvifDeviceCollection setValue(List<DiscoveredOnvifDevice> value) {
        this.value = value;
        return this;
    }
}


text:
package entidades;

import java.awt.image.BufferedImage;

public class Animacion {

	private int velocidad;
	private int indice;
	private long ultimoTiempo, timer;
	private BufferedImage[] frames;

	public Animacion(int velocidad, BufferedImage[] frames) {
		this.velocidad = velocidad;
		this.frames = frames;
		indice = 0;
		timer = 0;
		ultimoTiempo = System.currentTimeMillis();
	}

	public void actualizar() {
		timer += System.currentTimeMillis() - ultimoTiempo;
		ultimoTiempo = System.currentTimeMillis();

		if(timer > velocidad) {
			indice++;
			timer = 0;
			if(indice >= frames.length) {
				indice = 0;
			}
		}
	}

	public void reset(){
		indice = 0;
	}

	public BufferedImage getFrameActual() {
		return frames[indice];
	}

	public int getFrame() {
		return indice;
	}
}


text:
module WhippetSpec (spec) where

import Whippet
import Test.Hspec
import Test.Hspec.QuickCheck

spec :: Spec
spec = do
  describe "removeDups" $ do
    it "returns the two lists concatenated, with duplicates removed" $ do
      removeDups ["foo", "bar", "baz"] ["buzz", "foo"] `shouldBe` ["foo", "bar", "baz", "buzz"]

  describe "exactMatches" $ do
    it "returns exact substring matches" $ do
      exactMatches "foo" ["xfoox", "bar", "XFOOX", "foobarbaz", "baz"] `shouldBe` ["xfoox", "XFOOX", "foobarbaz"]

  describe "inexactMatches" $ do
    it "returns exact substring matches" $ do
      inexactMatches "foo" ["xfoox", "bar", "bfoazo", "fbaroo"] `shouldBe` ["xfoox", "bfoazo", "fbaroo"]


text:
set -exo pipefail

tmpdir=$(mktemp --directory)

ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
source "${ROOT}/script/lib/ui.sh"

usage() {
  cat <<USAGE >&2
usage: $0 <image|app> <dashboard|installer>
USAGE
}

main() {
  local target pkg
  case $2 in
    dashboard)
      target=$2
      pkg="main"
      ;;
    installer)
      target=$2
      pkg=$2
      ;;
    *)
      echo "unknown target"
      exit 1
      ;;
  esac

  case $1 in
    image)
      image $target
      ;;
    app)
      app $target $pkg
      ;;
    *)
      echo "unknown command"
      exit 1
      ;;
  esac

  rm --recursive --force "${tmpdir}"
}

image() {
  local target
  target=$1

  cp ${ROOT}/util/assetbuilder/Dockerfile ${ROOT}/${target}/app/Gemfile* "${tmpdir}"
  docker build --tag flynn/${target}-builder "${tmpdir}"
}

app() {
  local target pkg dir
  target=$1
  pkg=$2
  dir=$(pwd)

  cp --recursive ${ROOT}/${target}/app/* "${tmpdir}"
  cp --recursive ${ROOT}/${target}/app/.eslintrc "${tmpdir}"
  cd "${tmpdir}"

  docker run \
    --volume "${tmpdir}:/build" \
    --workdir /build \
    flynn/${target}-builder \
    bash -c "cp --recursive /app/.bundle . && cp --recursive /app/vendor/bundle vendor/ && cp --recursive /app/node_modules . && ./compiler && chown -R $(id -u):$(id -g) ."

  rm -f app # {target}/app/compiler.go -> {target}/app/app binary
  mkdir app
  mv build app
  cd ${ROOT}/${target}
  ./bin/go-bindata -nomemcopy -nocompress -prefix ${tmpdir}/ -pkg ${pkg} ${tmpdir}/app/build/...
  cd ${dir}
}

main "$@"


text:
from __future__ import unicode_literals, print_function

import numpy as np
import cv2

__all__ = [
    'MarkerDetector'
]

class MarkerDetector(object):
    QUADRILATERAL_POINTS = 4
    BLACK_THRESHOLD = 100
    WHITE_THRESHOLD = 155
    MARKER_NAME_INDEX = 3

    def __init__(self):
        with np.load('calib/mine_cam.npz') as calib:
            self.mtx, self.dist, = [calib[i] for i in ('mtx', 'dist')]

    def detect(self, image):

        markers = []

        # Stage 1: Convert the image into gray scale on threshold
        gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        thresh = cv2.adaptiveThreshold(gray, 255,
                                       cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                       cv2.THRESH_BINARY_INV, 3, 3)

        # Stage 2: Find contours
        _, contours, _ = cv2.findContours(thresh, cv2.RETR_LIST,
                                          cv2.CHAIN_APPROX_SIMPLE)

        # sort contours
        contours = sorted(contours, key=cv2.contourArea, reverse=True)[:20]

        for cnt in contours:

            # Stage 3: Shape check
            perimeter = cv2.arcLength(cnt, True)
            # approx = cv2.approxPolyDP(contour, 0.01*perimeter, True)
            approx = cv2.approxPolyDP(cnt, 0.05 * perimeter, True)

            if len(approx) == self.QUADRILATERAL_POINTS:

                # Stage 4: Perspective warping
                topdown_quad = self.warping_transform(gray, approx.reshape(4, 2))

                # Stage 5: Border check
                if topdown_quad[(topdown_quad.shape[0] / 100.0) * 5,
                                (topdown_quad.shape[
                                     1] / 100.0) * 5] > self.BLACK_THRESHOLD:
                    continue

                # Stage 6: Get marker pattern
                marker_pattern = None

                try:
                    marker_pattern = self.get_marker_pattern(topdown_quad,
                                                             self.BLACK_THRESHOLD,
                                                             self.WHITE_THRESHOLD)
                except:
                    continue

                if not marker_pattern:
                    continue

                # Stage 7: Match marker pattern
                marker_found, marker_rotation, marker_name = self.match_marker_pattern(
                    marker_pattern)

                if marker_found:

                    # Stage 8: Duplicate marker check
                    if marker_name in [marker[self.MARKER_NAME_INDEX] for marker
                                       in markers]:
                        continue

                    # Stage 9: Get rotation and translation vectors
                    print('----------------- 0.o -----------------------------')
                    rvecs, tvecs = self.get_vectors(image, approx.reshape(4, 2),
                                                    self.mtx, self.dist)
                    markers.append([rvecs, tvecs, marker_rotation, marker_name])

        return markers

    def _marker_coords(self, max_width, max_height):
        print('max_width and max_height is', max_width, max_height)
        return np.array([
            [0, 0],
            [max_width - 1, 0],
            [max_width - 1, max_height - 1],
            [0, max_height - 1]], dtype='float32')

    def warping_transform(self, image, src):

        # src and dst points
        src = self._order_points(src)

        (max_width, max_height) = self._width_height(src)
        dst = self._marker_coords(max_width, max_height)

        # warp perspective
        matrix = cv2.getPerspectiveTransform(src, dst)
        warped = cv2.warpPerspective(image, matrix, self._width_height(src))
        _, warped = cv2.threshold(warped, 125, 255,
                                  cv2.THRESH_BINARY + cv2.THRESH_OTSU)

        return warped

    def _width_height(self, points):

        tl, tr, br, bl = points

        top_width = np.sqrt(((tr[0] - tl[0]) ** 2) + ((tr[1] - tl[1]) ** 2))
        bottom_width = np.sqrt(((br[0] - bl[0]) ** 2) + ((br[1] - bl[1]) ** 2))

        width = max(int(top_width), int(bottom_width))

        left_height = np.sqrt(((tl[0] - bl[0]) ** 2) + ((tl[1] - bl[1]) ** 2))
        right_height = np.sqrt(((tr[0] - br[0]) ** 2) + ((tr[1] - br[1]) ** 2))

        height = max(int(left_height), int(right_height))

        return width, height

    def _order_points(self, points):
        s = points.sum(axis=1)
        diff = np.diff(points, axis=1)

        ordered_points = np.zeros((4, 2), dtype=np.float32)

        ordered_points[0] = points[np.argmin(s)]
        ordered_points[2] = points[np.argmax(s)]
        ordered_points[1] = points[np.argmin(diff)]
        ordered_points[3] = points[np.argmax(diff)]

        return ordered_points

    def get_marker_pattern(self, image, black_threshold, white_threshold):
        # collect pixel from each cell (left to right, top to bottom)
        cells = []

        cell_half_width = int(round(image.shape[1] / 10.0))
        cell_half_height = int(round(image.shape[0] / 10.0))

        for i in range(3, 9, 2):
            for j in range(3, 9, 2):
                cells.append(image[cell_half_height * i, cell_half_width * j])

        # threshold pixels to either black or white
        for idx, val in enumerate(cells):
            if val < black_threshold:
                cells[idx] = 0
            elif val > white_threshold:
                cells[idx] = 1
            else:
                return None
        return cells

    def get_vectors(self, image, points, mtx, dist):

        # order points
        points = self._order_points(points)

        # set up criteria, image, points and axis
        criteria = (
            cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)

        gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

        imgp = np.array(points, dtype=np.float32)

        objp = np.array([[0., 0., 0.], [1., 0., 0.],
                         [1., 1., 0.], [0., 1., 0.]], dtype=np.float32)

        # calculate rotation and translation vectors
        cv2.cornerSubPix(gray, imgp, (11, 11), (-1, -1), criteria)

        ret, rvecs, tvecs = cv2.solvePnP(objp, imgp, mtx, dist)

        return rvecs, tvecs

    # match marker pattern to database record
    def match_marker_pattern(self, marker_pattern):
        marker_found = False
        marker_rotation = None
        marker_name = None

        for marker_record in MARKER_TABLE:
            for idx, val in enumerate(marker_record[0]):
                if marker_pattern == val:
                    marker_found = True
                    marker_rotation = idx
                    marker_name = marker_record[1]
                    break
            if marker_found:
                val = 0
                for i, x in enumerate(marker_pattern):
                    val += x * np.power(2, i)

                break

        return marker_found, marker_rotation, marker_name


text:
class NotificationsController < ApplicationController
  before_action :set_notification, only: [:show, :edit, :update, :destroy]
  helper_method :validate_params
  include SecurityHelper
  # Give permission to manage notifications to appropriate roles
  def action_allowed?
    ['Instructor',
     'Teaching Assistant',
     'Administrator'].include? current_role_name
  end

  def run_get_notification
    redirect_to controller: :student_task, action: :view if current_user.try(:student?)
  end

  # GET /notifications
  def list
    @notifications = Notification.all
  end

  # GET /notifications
  def index
    @notifications = Notification.all
  end

  # GET /notifications/1
  def show; end

  # GET /notifications/new
  def new
    @notification = Notification.new
  end

  # GET /notifications/1/edit
  def edit; end

  # POST /notifications
  def create
    if params[:notification] && (warn_for_special_chars(params[:notification][:subject], "Subject") ||
        warn_for_special_chars(params[:notification][:description], "Description"))
      redirect_back
      return
    end
    @notification = Notification.new(notification_params)

    if @notification.save
      redirect_to @notification, notice: 'Notification was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /notifications/1
  def update
    if !params_valid?
      redirect_back
      return
    end
    respond_to do |format|
      if @notification.update(notification_params)
        format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }
      else
        format.html { render :edit }
      end
    end
  end

  # DELETE /notifications/1
  def destroy
    # Remove any hidden notifications
    @individual_notification = TrackNotification.all
    @individual_notification.each do |notification|
      notification.destroy if notification.notification == @notification.id
    end
    @notification.destroy
    redirect_to notifications_url, notice: 'Notification was successfully destroyed.'
  end

  private

  # Use callbacks to share common setup or constraints between actions.
  def set_notification
    @notification = Notification.find(params[:id])
  end

  # Only allow a trusted parameter "white list" through.
  def notification_params
    params.require(:notification).permit(:subject, :description, :expiration_date, :active_flag)
  end
end


text:
This package allows to autocomplete functions of p5.js library. This library is based in processing-autocomple:
https://github.com/Stefterv/processing-autocomplete

![A screenshot of your package](https://github.com/JoseU/p5xjs-autocomplete/blob/master/Screenshot%20P5autocompletelibrary.png)


text:
/*
* Name: LoginPresenter.java
* Package: it.kaizenteam.app.presenter
* Location: Sources/Applicazione/main/java/it/kaizenteam/app/presenter
* Date: 2015-05-23
* Version: v1.00
*
* History:
* =================================================================
* Version	Date	Programmer	Changes
* =================================================================
* v1.00 2015-06-15  Carlon Chiara  Approved
* =================================================================
* v0.04 2015-06-01  Moretto Alessandro  Verify
* =================================================================
* v0.03 2015-05-29  Pavanello Fabio Matteo Edit
* =================================================================
* v0.02 2015-05-26  Moretto Alessandro   Verify
* =================================================================
* v0.01 2015-05-23  Dal Bianco Davide  Creation
* =================================================================
*
*/

package it.kaizenteam.app.presenter;

/**
 * LoginPresenter is the interface LoginPresenterImpl.
 */
public interface LoginPresenter extends Presenter{
    /**
     * This method handles the gesture of a user click on the button in the login view. It will attempt to login by placing the waiting signal on view and if it has success shows the view with the list of chart otherwise appears on view an error message.
     * @param addressNorris
     * @param login
     * @param password
     */
    void onLoginClick(String addressNorris, String login, String password);
}


text:
package quasar.physical.mongodb

import slamdata.Predef._
import quasar.ejson.EJson
import quasar.fp._
import quasar.fp.ski._
import quasar._, Planner._

import java.time.{Instant, LocalDate, LocalDateTime, ZoneOffset}

import matryoshka._
import matryoshka.implicits._
import matryoshka.patterns._
import monocle.Prism
import scalaz._, Scalaz._
import scodec.bits.ByteVector

object BsonCodec {
  private def pad2(x: Int) = if (x < 10) "0" + x.toString else x.toString
  private def pad3(x: Int) =
    if (x < 10) "00" + x.toString else if (x < 100) "0" + x.toString else x.toString

  object EJsonType {
    def apply(typ: String): Bson =
      Bson.Doc(ListMap("_ejson.type" -> Bson.Text(typ)))

    def unapply(bson: Bson) = bson match {
      case Bson.Doc(map) => map.get("_ejson.type") >>= {
        case Bson.Text(str) => str.some
        case _              => None
      }
      case _ => None
    }
  }

  object EJsonTypeSize {
    def apply(typ: String, size: Int): Bson =
      Bson.Doc(ListMap(
        "_ejson.type" -> Bson.Text(typ),
        "_ejson.size" -> Bson.Int32(size)))

    def unapply(bson: Bson) = bson match {
      case Bson.Doc(map) =>
        ((map.get("_ejson.type") ⊛ map.get("_ejson.size")) {
          case (Bson.Text(str), Bson.Int32(size)) => (str, size).some
          case (Bson.Text(str), Bson.Int64(size)) => (str, size.toInt).some
          case _                                  => None
        }).join
      case _ => None

    }
  }

  def fromCommon(v: BsonVersion): Algebra[ejson.Common, Bson] = {
    case ejson.Arr(value)  => Bson.Arr(value)
    case ejson.Null()      => Bson.Null
    case ejson.Bool(value) => Bson.Bool(value)
    case ejson.Str(value)  => Bson.Text(value)
    case ejson.Dec(value) if v lt BsonVersion.`1.1`
                           => Bson.Dec(value.toDouble)
    case ejson.Dec(value) if value.isDecimalDouble
                           => Bson.Dec(value.toDouble)
    case ejson.Dec(value)  => Bson.Dec128(value)
  }

  def extract[A](fa: Option[Bson], p: Prism[Bson, A]): Option[A] =
    fa.flatMap(p.getOption)

  val millisPerSec = 1000
  val nanosPerSec = 1000000000L

  val fromExtension: AlgebraM[PlannerError \/ ?, ejson.Extension, Bson] = {
    case ejson.Map(value) => value.traverse(_.bitraverse({
      case Bson.Text(key) => key.right
      case _              =>
        NonRepresentableEJson(value.toString + " is not a valid document key").left
    }, _.right)) ∘ (m => Bson.Doc(ListMap(m: _*)))
    // FIXME: cheating, but it's what we're already doing in the SQL parser
    case ejson.Char(value)      => Bson.Text(value.toString).right
    case ejson.Byte(value)      => Bson.Binary.fromArray(Array[Byte](value)).right
    case ejson.Int(value)       =>
      if (value.isValidInt) Bson.Int32(value.toInt).right
      else if (value.isValidLong) Bson.Int64(value.toLong).right
      else NonRepresentableEJson(value.toString + " is too large").left
    case ejson.Meta(value, meta) => (meta, value) match {
      case (EJsonType("_bson.oid"), Bson.Text(oid)) =>
        Bson.ObjectId.fromString(oid) \/> ObjectIdFormatError(oid)
      case (EJsonTypeSize("_ejson.binary", size), Bson.Text(data)) =>
        if (size.isValidInt)
          ejson.z85.decode(data).fold[PlannerError \/ Bson](
            NonRepresentableEJson(""" + data + "" is not a valid Z85-encoded string").left)(
            bv => Bson.Binary(ImmutableArray.fromArray(bv.take(size.toLong).toArray)).right)
        else NonRepresentableEJson(size.shows + " is too large for binary data").left
      case (EJsonType("_ejson.date"), Bson.Doc(map)) =>
        (extract(map.get("year"), Bson._int32) ⊛
          extract(map.get("day_of_year"), Bson._int32))((y, d) =>
          LocalDate.ofYearDay(y, d))
          .orElse((extract(map.get("year"), Bson._int32) ⊛
            extract(map.get("month"), Bson._int32) ⊛
            extract(map.get("day_of_month"), Bson._int32))((y, m, d) =>
            LocalDate.of(y, m, d)))
          .flatMap(date => Bson.Date.fromInstant(date.atStartOfDay.toInstant(ZoneOffset.UTC))) \/>
          NonRepresentableEJson(value.shows + " is not a valid date")
      case (EJsonType("_ejson.time"), Bson.Doc(map)) =>
        (extract(map.get("hour"), Bson._int32) ⊛
          extract(map.get("minute"), Bson._int32) ⊛
          extract(map.get("second"), Bson._int32) ⊛
          extract(map.get("nanosecond"), Bson._int32))((h, m, s, n) =>
          Bson.Text(
            pad2(h) + ":" +
              pad2(m) + ":" +
              pad2(s) + "." +
              pad3(n))) \/>
        NonRepresentableEJson(value.shows + " is not a valid time")
      case (EJsonType("_ejson.interval"), Bson.Doc(map)) =>
        extract(map.get("seconds"), Bson._dec).map(s => Bson.Dec(s * millisPerSec)) \/>
          NonRepresentableEJson(value.shows + " is not a valid interval")
      case (EJsonType("_ejson.timestamp"), Bson.Doc(map)) =>
        (extract(map.get("year"), Bson._int32) ⊛
          extract(map.get("month"), Bson._int32) ⊛
          extract(map.get("day_of_month"), Bson._int32) ⊛
          extract(map.get("hour"), Bson._int32) ⊛
          extract(map.get("minute"), Bson._int32) ⊛
          extract(map.get("second"), Bson._int32) ⊛
          extract(map.get("nanosecond"), Bson._int32))((y, mo, d, h, mi, s, n) =>
          Bson.Date.fromInstant(LocalDateTime.of(y, mo, d, h, mi, s, n).toInstant(ZoneOffset.UTC))).join \/>
          NonRepresentableEJson(value.shows + " is not a valid timestamp")
      case (_, _) => value.right
    }
  }

  def fromEJson(v: BsonVersion): AlgebraM[PlannerError \/ ?, EJson, Bson] =
    _.run.fold(fromExtension, fromCommon(v)(_).right)

  /** Converts the parts of `Bson` that it can, then stores the rest in,
    * effectively, `Free.Pure`.
    */
  def toEJson[F[_]](implicit C: ejson.Common :<: F, E: ejson.Extension :<: F):
      ElgotCoalgebra[Bson \/ ?, F, Bson] = {
    case Bson.Arr(value)       => C.inj(ejson.Arr(value)).right
    case Bson.Doc(value)       =>
      E.inj(ejson.Map(value.toList.map(_.leftMap(Bson.Text(_))))).right
    case Bson.Null             => C.inj(ejson.Null()).right
    case Bson.Bool(value)      => C.inj(ejson.Bool(value)).right
    case Bson.Text(value)      => C.inj(ejson.Str(value)).right
    case Bson.Dec(value) if (!value.isNaN && !value.isInfinity)
                               => C.inj(ejson.Dec(value)).right
    case Bson.Dec128(value)    => C.inj(ejson.Dec(value)).right
    case Bson.Int32(value)     => E.inj(ejson.Int(value)).right
    case Bson.Int64(value)     => E.inj(ejson.Int(value)).right
    case Bson.Date(value)      =>
      val ldt = LocalDateTime.ofInstant(Instant.ofEpochMilli(value), ZoneOffset.UTC)
      E.inj(ejson.Meta(
        Bson.Doc(ListMap(
          "year"         -> Bson.Int32(ldt.getYear),
          "month"        -> Bson.Int32(ldt.getMonth.getValue),
          "day_of_month" -> Bson.Int32(ldt.getDayOfMonth),
          "hour"         -> Bson.Int32(ldt.getHour),
          "minute"       -> Bson.Int32(ldt.getMinute),
          "second"       -> Bson.Int32(ldt.getSecond),
          "nanosecond"   -> Bson.Int32(ldt.getNano))),
        EJsonType("_ejson.timestamp"))).right
    case Bson.Binary(value)    =>
      E.inj(ejson.Meta(
        Bson.Text(ejson.z85.encode(ByteVector.view(value.toArray))),
        EJsonTypeSize("_ejson.binary", value.size))).right
    case id @ Bson.ObjectId(_) =>
      E.inj(ejson.Meta(Bson.Text(id.str), EJsonType("_bson.oid"))).right
    case bson                  => bson.left
  }

  def fromData(v: BsonVersion, data: Data): PlannerError \/ Bson =
    data.hyloM[PlannerError\/ ?, CoEnv[Data, EJson, ?], Bson](
      interpretM({
        case Data.NA => Bson.Undefined.right
        case data    => NonRepresentableData(data).left
      },
        fromEJson(v)),
      Data.toEJson[EJson].apply(_).right)

  def toData(bson: Bson): Data =
    bson.hylo[CoEnv[Bson, EJson, ?], Data](
      interpret(κ(Data.NA), Data.fromEJson),
      toEJson[EJson] ⋙ (CoEnv(_)))
}


text:
package info.u_team.u_team_core.item.tier;

import java.util.Iterator;

import com.google.common.collect.Iterators;

import net.minecraft.world.item.TieredItem;
import net.minecraftforge.registries.RegistryObject;

public record TierSet(RegistryObject<UAxeItem> axe, RegistryObject<UHoeItem> hoe, RegistryObject<UPickaxeItem> pickaxe, RegistryObject<UShovelItem> shovel, RegistryObject<USwordItem> sword) implements Iterable<RegistryObject<? extends TieredItem>> {

	@Override
	public Iterator<RegistryObject<? extends TieredItem>> iterator() {
		return Iterators.forArray(axe, hoe, pickaxe, shovel, sword);
	}
}


text:
<?php

namespace Adventure;

use Adventure\Test\TestGame;
use Adventure\Test\TestScenery;
use PHPUnit\Framework\TestCase;

/**
 * Direction enumeration tests
 *
 * @author    jorgetite
 * @since     2017-05-02
 * @version   1.0
 * @copyright Copyright (c) 2017 Jorge Tite
 */
class GameTest extends TestCase
{
    /**
     * @var Character
     *      the fixture for this test
     */
    private $character;

    /**
     * @var Scenery
     *      the fixture for this test
     */
    private $scenery;

    /**
     * @var Game
     *      the fixture for this test
     */
    private $game;

    /**
     * sets up a fixture for this test.
     */
    public function setUp() : void
    {
        $this->character = new Character();
        $this->scenery   = new TestScenery();

        $this->game = new TestGame($this->character, $this->scenery);
    }

    /**
     * Test the creation of a new game
     */
    public function testNewGame() : void
    {
        $this->assertEquals($this->character, $this->game->getCharacter());
        $this->assertEquals($this->scenery, $this->game->getScenery());
        $this->assertEquals("Center space.",
            $this->game->getCharacter()->getCurrentSpace()->getDescription());
    }

    /**
     * Test the creation of a new game defining a parser
     */
    public function testNewGameWithParser() : void
    {
        $parser = new TokenParser("*");
        $game = new TestGame($this->character, $this->scenery, $parser);

        $this->assertSame($parser, $game->getParser());
    }

    /**
     * Test getWelcomeMessage method
     */
    public function testGetWelcomeMessage() : void
    {
        $this->assertEquals("Welcome!", $this->game->getWelcomeMessage());
    }

    /**
     * Test processInput method
     */
    public function testProcessInput() : void
    {
        $res = $this->game->processInput("move north");
        $this->assertEquals("North space.", $res);
    }

    /**
     * Test processInput wrong command
     */
    public function testProcessInputNoCommand() : void
    {
        $res = $this->game->processInput("command");
        $this->assertEquals("I don't understand that word.", $res);
    }

    /**
     * Test processInput character wins game
     */
    public function testProcessInputWin() : void
    {
        $res = $this->game->processInput("win");
        $this->assertEquals("You win. Congratulations, you won!", $res);
        $this->assertTrue($this->game->getCharacter()->hasWon());
    }

    /**
     * Test processInput character quits game
     */
    public function testProcessInputQuit() : void
    {
        $res = $this->game->processInput("quit");
        $this->assertEquals("Bye! Thanks for playing.", $res);
        $this->assertTrue($this->game->getCharacter()->hasQuit());
    }

    /**
     * Test processInput when character already won
     */
    public function testProcessInputAlreadyWon() : void
    {
        $this->game->getCharacter()->setHasWon(true);

        $res = $this->game->processInput("move");
        $this->assertEquals("Congratulations, you won!", $res);
    }

    /**
     * Test processInput when character already quit
     */
    public function testProcessInputAlreadyQuit() : void
    {
        $this->game->getCharacter()->setHasQuit(true);

        $res = $this->game->processInput("move");
        $this->assertEquals("The game has ended. Thanks for playing.", $res);
    }
}


text:
export class AnimationKeyframe {
    constructor(offset, styles) {
        this.offset = offset;
        this.styles = styles;
    }
}
//# sourceMappingURL=animation_keyframe.js.map


text:
<?php

declare(strict_types=1);

namespace Atk4\Core;

/**
 * This trait implements https://github.com/php/php-src/pull/7390 for lower PHP versions
 * and also emit a warning when isset() is called on undefined variable.
 */
trait WarnDynamicPropertyTrait
{
    protected function warnPropertyDoesNotExist(string $name): void
    {
        // match native PHP behaviour as much as possible
        // https://3v4l.org/2KR3m
        $class = static::class;
        try {
            $propRefl = new \ReflectionProperty($class, $name);
            if (!$propRefl->isPrivate() && !$propRefl->isPublic() && !$propRefl->isStatic()) {
                throw new \Error('Cannot access protected property ' . $class . '::$' . $name);
            }
        } catch (\ReflectionException $e) {
        }

        'trigger_error'('Undefined property: ' . get_debug_type($this) . '::$' . $name, \E_USER_WARNING);
    }

    public function __isset(string $name): bool
    {
        $this->warnPropertyDoesNotExist($name);

        return isset($this->{$name});
    }

    /**
     * @return mixed
     */
    public function &__get(string $name)
    {
        $this->warnPropertyDoesNotExist($name);

        return $this->{$name};
    }

    /**
     * @param mixed $value
     */
    public function __set(string $name, $value): void
    {
        $this->warnPropertyDoesNotExist($name);

        $this->{$name} = $value;
    }

    public function __unset(string $name): void
    {
        $this->warnPropertyDoesNotExist($name);

        unset($this->{$name});
    }
}


text:
/**
 * @fileoverview Code for busting ghost clicks. In PSOL, this is mainly used
 * to bust 'click' events from previous page during page navigation.
 *
 * @author ksimbili@google.com (Kishore Simbili)
 */

goog.require('wireless.events.clickbuster');

// 'preventGhostClick' takes coordinate always. The passed in coordinate is the
// click coordinate to prevent. ClickBuster prevents click event on a
// coordinate, if it is not found in any of the touch events received so far.
// But during page navigation, touch event coordinates are empty and so first
// click event at any coordinate will be considered ghost click and will be
// prevented.
// We are passing 0,0 as params, since coordinate is compulsory. It doesn't
// really matter.
wireless.events.clickbuster.preventGhostClick(0, 0);


text:
namespace three {

  class MeshBasicMaterial : public three::Material
  {
    public:
      static uint32_t Type;

    public:
      MeshBasicMaterial();

      uint32_t type() const { return MeshBasicMaterial::Type; }

      void apply(Renderer * renderer);

      std::string vertexShaderCode() const;
      std::string fragmentShaderCode() const;

      const char * textureName(uint32_t slot) const;
      const char * uniformName(uint32_t slot) const;
      uint32_t textureCount() const { return 3; }
      uint32_t uniformCount() const { return 7; }

    public:
      three::Texture * map;
      three::Texture * lightMap;
      three::Texture * envMap;
      three::Vector4 offsetRepeat;
      three::Color diffuse;
      float opacity;
      float flipEnvMap;
      int  useRefract;
      float reflectivity;
      float refractionRatio;

      bool useTextureMap;
      bool useLightMap;
      bool useEnvMap;
      bool doubleSided;
      bool useVertexColor;
      bool gammaCorrection;
      bool useReflectivity;
  };

  class MeshPhongMaterial : public three::Material
  {
    public:
      static uint32_t Type;

    public:
      MeshPhongMaterial();

      uint32_t type() const { return MeshPhongMaterial::Type; }

      void apply(Renderer * renderer);

      std::string vertexShaderCode() const;
      std::string fragmentShaderCode() const;

      const char * textureName(uint32_t slot) const;
      const char * uniformName(uint32_t slot) const;
      uint32_t textureCount() const { return 2; }
      uint32_t uniformCount() const { return 0; }

    public:
      three::Texture * map;
      three::Texture * lightMap;

  };

}


text:
module Main where

import Control.Exception (Handler(..))
import qualified Control.Exception as E (catches)
import Control.Monad (when)
import Data.List (isPrefixOf, intercalate)
import Data.Maybe (isNothing)
import Distribution.Cab
import System.Console.GetOpt (ArgOrder(..), OptDescr(..), getOpt')
import System.Environment (getArgs)
import System.Exit (ExitCode, exitFailure)
import System.IO

import Commands
import Doc
import Help
import Options
import Run
import Types

----------------------------------------------------------------

main :: IO ()
main = flip E.catches handlers $ do
    oargs <- getArgs
    let pargs = parseArgs getOptDB oargs
    checkOptions1 pargs illegalOptionsAndExit
    let Right (args,opts0) = pargs
    when (args == []) helpAndExit
    when (OptHelp `elem` opts0) $ helpCommandAndExit args [] []
    let opts1 = filter (/= OptHelp) opts0
        act:params = args
        mcmdspec = commandSpecByName act (commandDB helpCommandAndExit)
    when (isNothing mcmdspec) (illegalCommandAndExit act)
    let Just cmdspec = mcmdspec
    checkOptions2 opts1 cmdspec oargs illegalOptionsAndExit
    run cmdspec params opts1
  where
    handlers = [Handler handleExit]
    handleExit :: ExitCode -> IO ()
    handleExit _ = return ()

----------------------------------------------------------------

illegalCommandAndExit :: String -> IO ()
illegalCommandAndExit x = do
    hPutStrLn stderr $ "Illegal command: " ++ x
    exitFailure

----------------------------------------------------------------

illegalOptionsAndExit :: UnknownOptPrinter
illegalOptionsAndExit xs = do -- FixME
    hPutStrLn stderr $ "Illegal options: " ++ intercalate " " xs
    exitFailure

----------------------------------------------------------------

type ParsedArgs = Either [UnknownOpt] ([Arg],[Option])

parseArgs :: [GetOptSpec] -> [Arg] -> ParsedArgs
parseArgs db args = case getOpt' Permute db args of
    (o,n,[],[])      -> Right (n,o)
    (_,_,unknowns,_) -> Left unknowns

----------------------------------------------------------------

type UnknownOpt = String
type UnknownOptPrinter = [UnknownOpt] -> IO ()

----------------------------------------------------------------

checkOptions1 :: ParsedArgs -> UnknownOptPrinter -> IO ()
checkOptions1 (Left es) func = func es
checkOptions1 _ _            = return ()

----------------------------------------------------------------

checkOptions2 :: [Option] -> CommandSpec -> [Arg] -> UnknownOptPrinter -> IO ()
checkOptions2 opts cmdspec oargs func =
    when (unknowns /= []) $
        func (concatMap (resolveOptionString oargs) unknowns)
  where
    unknowns = unknownOptions opts cmdspec

unknownOptions :: [Option] -> CommandSpec -> [Switch]
unknownOptions opts cmdspec = chk specified supported
  where
    chk [] _     = []
    chk (x:xs) ys
      | x `elem` ys = chk xs ys
      | otherwise   = x : chk xs ys
    specified = map toSwitch opts
    supported = map fst $ switches cmdspec

resolveOptionString :: [Arg] -> Switch -> [UnknownOpt]
resolveOptionString oargs sw = case lookup sw optionDB of
    Nothing    -> error "resolveOptionString"
    Just gspec -> let (s,l) = getOptNames gspec
                  in checkShort s ++ checkLong l
  where
    checkShort s = filter (==s) oargs
    checkLong  l = filter (l `isPrefixOf`) oargs

getOptNames :: GetOptSpec -> (String,String)
getOptNames (Option (c:_) (s:_) _ _) = ('-':[c],'-':'-':s)
getOptNames _                        = error "getOptNames"


text:
layout: post
title: Moving to Github Pages
permalink: /blog/trapias.github.io
poster: https://s3.amazonaws.com/ooomf-com-files/bXoAlw8gT66vBo1wcFoO_IMG_9181.jpg
tags: github bootstrap
---

**Update, 2015-06-09:** Dnn site at albe.ihnet.it switched off, no time to update it. Contact me if you need something that was on that site.

After some years I decided to turn off my DNN site at [https://albe.ihnet.it](https://albe.ihnet.it), and to maintain a simpler personal site thanks to Github Pages.

Image by Unsplash

##Goodbye Dnn
The DNN site will soon be closed, but I'll port relevant content to this new site.
I'm not planning to deploy a new Dnn site atm.

##Welcome jekyll, thanks Github
This site is static html generated with [jekyll](https://jekyllrb.com/) and (freely! :beer:) hosted at Github by their [Github Pages](https://pages.github.com/) service.

![jekyll]({{ site.baseurl }}/images/jekyll-logo.png)


text:
import functools
import datetime
import logging

logger = logging.getLogger(__name__)

def weekday(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        if datetime.date.today().weekday() in range(0, 5):
            return func(*args, **kwargs)
        else:
            logger.debug("Skipping {0} since it is not a weekday".format(func))

    return wrapper


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>org.mini2Dx.minibus.transmission (minibus 1.2.0 API)</title>
<meta name="date" content="2017-04-24">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

org.mini2Dx.minibus.transmission

Classes

MessageTransmission

MessageTransmissionPool


text:
layout : default
title : AGDG Links
---
# Amateur Game Dev General
![JLMG](img/AGDG.png)

[>>>/vg/agdg](http://boards.4chan.org/vg/catalog#s=agdg)

[>>>archive/vg/agdg](http://archive.foolz.us/vg/search/text/AGDG/type/op/)

[>>>RECAP MONDAY](http://homph.com/recap)

[>>>dropbox/agdg](https://www.dropbox.com/sh/adcbqwhnk9iczxq/2TvhIxQ9UA)

## AGDG resources
*	<https://docs.google.com/spreadsheet/ccc?key=0Aq3t6_4BZDVndHRVekxUYjladjhCby1ST3g0RXllenc&usp=sharing#gid=0>

	The AGDG project spreadsheet.

*	<http://www.zeemaps.com/map?group=561827>

	Meet hot gamedevs in your area!

*	<http://soundcloud.com/groups/agdg-audiofriends>

	<http://pastebin.com/hC7VfYE3>

	Super AGDG Music Bros. Ask them to make music for your game, then stop replying to emails.

*	<https://docs.google.com/spreadsheet/ccc?key=0Ap2hrAnMNJ6kdHBzd0ZqTk5ZU2dLX1NZTVNrSUxDUXc#gid=0>

	AGDG Tutors. Be sure to ask them to do your homework.

*	<https://www.dropbox.com/sh/adcbqwhnk9iczxq/2TvhIxQ9UA>

	The Dropbox progress archive. scroll down for older archives

*	irc://chat.freenode.net/##agdg

	irc://chat.freenode.net/#vidyadev

	[Webchat for both channels](https://webchat.freenode.net/?channels=#vidyadev,##agdg&randomnick=1&prompt=1)

	IRC. the channels are about idling and Dota2 respectively

*	<http://steamcommunity.com/groups/vgamedevcrew>

	>I warn all people against this group as there are probably real rapists within.

## posting progress

Thanks to the Infinte Wisdom of our Lord and saviour Moot, we now
have two different formats to post our game in motion with.

### WEB 'EM

webm files are just video files that get their sound stripped out
when they're posted on 4chan. They are functionally identical to gifs, but with a much better compression ratio, which naturally leads to longer, better looking loops.

*	<https://github.com/TheTarkus/WebMCam>

Nowadays, you can just use WebmCam, which provides a point'n'shoot interface for grabbing screencaps.
If that's too easy for you, the ~~right~~ *old* way to make webm files is to
create video files using a screen capture tool, edit if them if
necessary, and then convert them to webm. This is understandably a pain, but worth knowing how to do, in case you want to make a longer video to put on youtube, or are on a platform where webmcam doesn't exist.

*	<http://exkode.com/dxtory-features-en.html>

	<http://obsproject.com>

	<http://fraps.com/>

	On Windows, these three programs will get video files of your game
in some format or the other. Since video encoding is actually a complex
business I suggest you google around for advice. Dxtory is good for long
or complex videos that would normally kill your rig, OBS can record most
anything competently, and fraps is buggy shit that people still use for
some reason. If you have a recent NVIDIA card, you may be able to use
the built-in video encoder to record, too. Caveat Emptor.

*	<http://en.wikipedia.org/wiki/Sony_Vegas_Pro>

	For video editors, anything will do, but a common favorite for
gaming is Sony Vegas. Figure it out nerd.

*	<http://github.com/WebMBro/WebMConverter>

	Once you have the video, you need to convert into the webm format
4chan expects. WebMConverter provides a retard-friendly interface for
that.

Once you've gotten past this gauntlet you should have a webm as good as any other, as well as raw footage for any of your other video needs.

### JIFS
If that doesn't float your boat, you can always make crusty old gifs with these point-and-shoot tools.

*	<http://cockos.com/licecap/>

	<http://blog.bahraniapps.com/?page_id=21>

	record your vidya to show to all your little internet buddies and complain when the colors come out wrong.

*	<http://github.com/WebMBro/WebMConverter>

	If you go over the file limit, you can convert to webm, but keep in
mind that this won't have nearly as good results as the native webm chain.

### Misc. hosting

*	<http://dropbox.com>

	Dropbox makes sharing webpages as easy as moving the finished page
into the Dropbox folder. Good for Unity webgames and HTML5 concoctions,
and you can host/change your packaged games here too.

* 	<http://1339.cf/>

	Filehosting using the pomf.se software, direct linking is allowed. Can
	be used for flash/love2d games, and is great for really any other
	game installers or files.

* 	<http://itch.io>

	If you think your game is ready for the big leagues, you can start
to beg for money by posting it on itch.io. Think of it like bandcamp but
for shitty games nobody wants to buy. The admin is very liberal about
hosting, to the point where it basically charity to new gamedevs.

*	<http://mega.co.nz>

	Use mega as a last resort. They'll host whatever, but the fact that
it doesn't provide any direct links and that it's blocked for many an
anon make it a pain to use.

*	<http://pastebin.com>

	<http://hastebin.com>

	Don't try to post your shit code to 4chan directly, use a pastebin. hastebin will autodetect language for syntax highlighting, which is nice.

*	<http://tumblr.com>
	> \#vidyadev #AGDG #smoke-weed-everyday #yoloswag

	Use/track those first two tags, they are progress specific.

## Guides and Tutorials
### Getting Started
*	<http://www.vine2d.com/post/17243872646/indie-game-dev-faq>

	Vidyadev 101.

*	<http://forums.tigsource.com/index.php>

	The Old Media /agdg/. Searchable.

*	<http://makegames.tumblr.com/post/1136623767/finishing-a-game>

	Finish your game. No really, go finish it.

*	<http://pixelprospector.com/indie-resources>

	How to spin your game into a business, with money and employees and shit.

*	<http://www.gamasutra.com/>

	An "insider" news site, much like Variety, but for games. Reprints a bunch of material from AAA gamedevs and successful indies alike.

* 	<https://github.com/WizardsWorkshop/permadeath>

	A blog in markdown format. Submit pull requests.

*	<http://vlambeer.com/toolkit>

	A link list, much like the one you're looking at now, for people looking to doll up/market/sell a mostly-finished game. Made by Vlambeer.
### Programming

*	<http://www-cs-students.stanford.edu/~amitp/gameprog.html>

	Algorithms commonly used in vidyadev. Check here for pathfinding, AI, Coordinate transforms, and Entity models.

*	<http://www.metanetsoftware.com/technique/tutorialA.html>

	A venerable collision detection tutorial. made by the guys who wrote N+.

*	<http://gafferongames.com/game-physics/>

	<http://gafferongames.com/networking-for-game-programmers/>

	Covers such topics as: Game physics and loop architecture, networking, state determinism in games and so forth. Mostly of interest to multiplayer devs.

*	<http://content.gpwiki.org/index.php>

	The Game Programming Wiki. Offers a lot of material, in a lot of different programming languages and libraries. Seems to have a low-level, engine creation bias.

### Art and Sound

*	<http://www.hongkiat.com/blog/pixel-art-tutorials/>

	Grab bag of pixel art tutorials, from beginner to intermediate.

*	<http://pastebin.com/8nSYsL7R>

	One anon's musicmaking process in guide format.

*	<http://youtu.be/Fy0aCDmgnxg>

	Juice it or Lose it, or: How to Polish your Turd to a Mirror Shine

## Free shit

All free shit will either be labeled CC-NOPE meaning not actually "free" per se and will probably slam you with a C&D, CC-BY-NC, meaning it cannot be used commercially, or CC0 meaning do whatever the fuck you want. Note that I am using these as umbrella licenses and they may or may not actually apply.

### Free Sounds

*	<http://www.freesound.org>

	A sound effect portal, includes both amateur and professional work. Not really geared toward gamedev. (CC-BY-NC)

*	<http://www.bfxr.net>

	Lofi bleeps 'n bloops synth. Click the mutate button and get 100% original, low-effort effects. Like sfxr but better. (CC0)

*	<https://soundcloud.com/search/sounds?q=vgm&filter.license=to_modify_commercially>

	Creative Commons licensed soundcloud tracks. Modify the search to fit your needs. (CC0)

### Free Grafix

*	<http://www.spriters-resource.com/>

	Sprites from existing games. (CC-NOPE)

*	<http://opengameart.org/>

	A portal for placeholder art. Licences vary. (CC-BY-NC)

*	<http://forums.tigsource.com/index.php?topic=8970.0>

	Oryx design labs sprites as seen in Realm of the Mad God. (CC-BY-NC)

*	<http://www.indiedb.com/groups/unity-devs/downloads/100-free-fantasy-assets-by-digital-roar-studios>

	100 fantasy-themed unity assets. (CC0)

*	<http://www.mediafire.com/?62mayh7us7jpgw9>

	<http://www.mediafire.com/?q8ycy9m7zswv7ri>

	<http://www.mediafire.com/?lrfxk4hth90clt3>

	Screenshots of lowpoly art. Good for references/inspiration. (CC-NOPE)

### Free(/Open-Source) Software

*	<https://github.com/amgade/gamedev-alternatives>

	Gamedev in a way that respects your freedumbs. Some of these are drop-in replacements for existing software, while others just fill the same gap. One of the easiest ways to get to do some collab work is to pick a project, get to work, and submit a pull request when you're done. (CC0/CC-BY-NC)

### 100% Original Ideas Don't Steal

*	<http://www.squidi.net/three/index.php>

*	<http://orteil.dashnet.org/gamegen>

*	<http://ideaguy.99k.org/>

## Ancient history

Everything here is considered `DEPRECATED`.

*	<http://vsrecommendedgames.wikia.com/wiki/Games_Made_by_/V/irgins>

	An old project list, Dates back to the /v/ days.

*	<http://dl.dropbox.com/u/14853701/AGDG/Dropbox.html>

	NG's Archive. updated till the end of July 2013.

	`>;_;7`

*	<https://www.copy.com/s/cVIdHlFyhkDR/AGDG>

	The copybox archive. Lasts most of august 2013.

*	<http://sites.google.com/site/vidyadevresources>

	More /v/ links. The tutorials are probably still fresh but the content/suggestions definitely aren't.

*	<http://pastebin.com/xM5d4qu1>

	A list of game library suggestions. Supposedly updated 2013, but the info calls now mature libraries indev and and references dead relics.

*	<http://pomf.se>

	Shut down as of June 2015 due to lack of funding. [read more](http://blog.pomf.se/post/121058516206/shutting-down)
	Filehosting for NEETs and weebs. Unlike every other public file
	host, pomf trusts its users enough to directly link to their files. Good
	for flash/love2d games, and basically anything else.

### How 2 edit

The Github repo is at <https://github.com/Alloyed/agdg-links>, submit
your pull requests and issues and shit there.