Skip to content

Instantly share code, notes, and snippets.

View autrilla's full-sized avatar

Adrian Utrilla autrilla

View GitHub Profile
public override BusinessBase NewObject(string ObjectName)
{
BusinessBase obj;
if (ObjectName == "UserApp")
{
return new CRM.Business.UserApp.UserApp();
}
obj = base.NewObject(ObjectName);
package com.favega.farmnet
import android.app.Activity
import android.support.design.widget.Snackbar
import android.support.v7.widget.CardView
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.Button
import android.widget.CheckBox
private fun updateProbes() {
Observable.just(1).delay(5, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({}, {}, { swipeRefreshLayout.isRefreshing = false })
}
private fun updateProbes() {
temperatureProbeService.listTemperatureProbes()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.flatMapIterable { probes -> probes }
.flatMap { probe ->
val temperature = temperatureProbeService.lastTemperature(probe.serialNumber)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
Observable.zip(Observable.just(probe), temperature, {one, two -> Pair(one, two)})
@Test
fun testNoInternetLogin() {
mActivityRule.activity.accountService = AlwaysInvalidAccountService()
Espresso.onView(ViewMatchers.withId(R.id.email)).perform(
ViewActions.typeText(mEmail),
ViewActions.closeSoftKeyboard()
)
Espresso.onView(ViewMatchers.withId(R.id.password)).perform(
ViewActions.typeText(mPassword),
ViewActions.closeSoftKeyboard()
@autrilla
autrilla / paxos
Last active January 16, 2016 10:23
X marks intersection points
Cliens want to write to a shared file
All acceptors and learners start with no one ('null') having access
ClientA ClientB Proposer Acceptor1 Acceptor2 Acceptor3 LearnerX LearnerY
| | | | | | | |
X------------------>| | | | | | Request(ClientA)
| | X--------->|----------->|---------->| | | Prepare(transaction_id=1)
| | |<---------X------------X-----------X | | Promise(transaction_id=1, {null, null, null}) // Acceptors answer with their current value, i.e. who currently has write access
| | X--------->|----------->|---------->| | | Accept(transaction_id=1, ClientA) // The proposer decides to let ClientA access the file
import scrapy
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
class StoreSpider(CrawlSpider):
name = 'store'
allowed_domains =['tiendaganadera.com', 'tiendaagricola.com']
start_urls = ['http://tiendaganadera.com/home.php',
'http://tiendaagricola.com/home.php']
import scrapy
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
class StoreSpider(CrawlSpider):
name = 'store'
allowed_domains =['tiendaganadera.com', 'tiendaagricola.com']
start_urls = ['http://tiendaganadera.com/home.php',
'http://tiendaagricola.com/home.php']
[ 1270.965]
X.Org X Server 1.17.1
Release Date: 2015-02-10
[ 1270.968] X Protocol Version 11, Revision 0
[ 1270.970] Build Operating System: Linux 3.19.2-1-ARCH x86_64
[ 1270.971] Current Operating System: Linux autrilla 3.19.3-3-ARCH #1 SMP PREEMPT Wed Apr 8 14:10:00 CEST 2015 x86_64
[ 1270.971] Kernel command line: initrd=\initramfs-linux.img root=UUID=80474b4b-2858-4e88-a367-f4cb9fe172d6 rw rootflags=subvol=rootvol systemd.unit=multi-user.target nomodeset
[ 1270.974] Build Date: 14 April 2015 10:34:18AM
[ 1270.976]
[ 1270.977] Current version of pixman: 0.32.6
from django.db import models
from django.utils import timezone
class Zone(models.Model):
''' Generic Zone superclass. '''
name = models.CharField(max_length=35)
class Farm(Zone):
''' Farm. Users can have many of these. '''