Skip to content

Instantly share code, notes, and snippets.

View eduardo22i's full-sized avatar
👨‍💻
//coding from 🏠

Eduardo Irías eduardo22i

👨‍💻
//coding from 🏠
View GitHub Profile
@eduardo22i
eduardo22i / And Scala
Last active December 14, 2015 16:39
Propuesta
def and2 (x:Boolean, y:Boolean) = println( x&y)
and2: (x: Boolean, y: Boolean)Unit
scala> and2(true,true)
true
scala> and2(true,false)
false
scala> and2(false,false)
scala> def squp (x:Int) = x*x
squp: (x: Int)Int
scala> squp(2)
res8: Int = 4
scala> squp(3)
res9: Int = 9
@eduardo22i
eduardo22i / Or2 Scala
Created March 8, 2013 14:47
Or2 Scala
scala> def or2 (x:Boolean, y:Boolean) = (x, y) match {
| case (false, false) => false
| case (_, _) => true
| }
or2: (x: Boolean, y: Boolean)Boolean
scala> or2(true,false)
res18: Boolean = true
@eduardo22i
eduardo22i / Tic-Tac-Toe Game
Last active August 29, 2015 14:12
A HTML/Javascript Tic-Tac-Toe game.
<html>
<head>
<title>Tic-Tac-Toe</title>
<style>
body {
font-family: sans-serif;
color: #535353;
}
.cell {
width: 100px;
@eduardo22i
eduardo22i / PHP Appstore Validator
Last active November 13, 2020 04:44
A file to validate an AppStore payment receipt using PHP.
<?php
//
// Appstore Production Purchase Validation
//
// Created by Eduardo Irías on 6/3/16.
//
$filebinary = basename($_FILES['receipt-data']['name']);
@eduardo22i
eduardo22i / sorting algorithms.swift
Created August 7, 2016 07:10
Swift sorting algorithms: Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, and Quick Sort
//: Swift sorting algorithms
//: Bubble Sort
func bubbleSort(list : [Int]) -> [Int] {
var list = list
let listCount = list.count
for oputer in (2..<listCount).reverse() {
@eduardo22i
eduardo22i / binary search tree.swift
Last active August 8, 2016 08:58
Swift binary search tree
class Node : NSObject {
var index : Int = -1
var data : AnyObject?
var left : Node? = nil
var right : Node? = nil
// Part 1
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
navigationView.setCheckedItem(R.id.nav_camera);
@eduardo22i
eduardo22i / Firebase Topics
Created December 15, 2017 15:54
An Extension of Firebase Messaging To Get Topics
extension Messaging {
static private let accessToken = "" //Server Web Key
struct Topic : Decodable {
var name : String?
var addDate : String?
}
struct Rel : Decodable {
protocol Vehicle {
var currentSpeed : Double { get }
func accelerate()
func decelerate()
}
extension Vehicle {
var isMoving : Bool { get { return currentSpeed != 0 } }
}