Skip to content

Instantly share code, notes, and snippets.

View rrgarciach's full-sized avatar

Ruy R. Garcia rrgarciach

View GitHub Profile
@rrgarciach
rrgarciach / Dockerfile
Created June 11, 2018 04:09
Go HTTP server example
FROM golang:alpine
ADD ./src /go/src/app
WORKDIR /go/src/app
ENV PORT=3001
CMD ["go", "run", "main.go"]
@rrgarciach
rrgarciach / RaspberryPi-RFID
Created August 27, 2017 19:46 — forked from mattgorecki/RaspberryPi-RFID
Python script to read RFID card from serial RFID reader attached to a Raspberry Pi. Also has a Exit button. The card swipe releases the maglock on the door.
#!/usr/bin/python2
import serial
import re, sys, signal, os, time, datetime
import RPi.GPIO as GPIO
BITRATE = 9600
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
@rrgarciach
rrgarciach / github-cards-react.js
Last active April 16, 2017 19:21
Github profile loader with React
const Card = (props) => {
return (
<div style={{margin: '1em'}}>
<img width="75" src={props.avatar_url} />
<div style={{display: 'inline-block', marginLeft: 10}}>
<div style={{fontSize: '1.25em', fontWeight: 'bold'}}>
{props.name}
</div>
<div>{props.company}</div>
</div>
'use strict';
angular.module('components.auth')
.provider('AuthSystemRoles', function () {
var roles = {
system : 'System User',
admin : 'Admin User',
account : 'Account Owner'
};
(function () {
'use strict';
/* @ngInject */
function config($stateProvider, $urlRouterProvider, AuthSystemRolesProvider) {
var systemRoles = AuthSystemRolesProvider.$get().getSystemRoles();
$urlRouterProvider
.when('/pricing/', '/pricing');
$stateProvider
@rrgarciach
rrgarciach / errorhandler.service.js
Created August 3, 2016 21:00
Error Handler Service
// api service calling example
apiService.get()
.then(response => {
return response.data;
})
.catch(err => {
return errorHandler(err);
});
@rrgarciach
rrgarciach / pre-push.sh
Created July 19, 2016 20:54 — forked from vlucas/pre-push.sh
Prevent Pushes Directly to Master
#!/bin/bash
# @link https://gist.github.com/mattscilipoti/8424018
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
@rrgarciach
rrgarciach / mediator-pattern.js
Created June 18, 2016 16:48
This is the mediator guy ;D
function Plane(planeName) {
this.planeName = planeName;
this.isFlying = false;
this.takeOff = function (track) {
if (track) {
if(!isFlying) {
track = false;
isFlying = true;
@rrgarciach
rrgarciach / catAttack.js
Created June 16, 2016 19:55
An Observer pattern example in JavaScript
function ObserverList(){
this.observerList = [];
}
ObserverList.prototype.add = function( obj ){
return this.observerList.push( obj );
};
ObserverList.prototype.count = function(){
return this.observerList.length;
<message name="getTermRequest">
<part name="term" type="xs:string"/>
</message>
<message name="getTermResponse">
<part name="value" type="xs:string"/>
</message>
<portType name="glossaryTerms">
<operation name="getTerm">