Skip to content

Instantly share code, notes, and snippets.

Avatar

Ruy R. Garcia rrgarciach

View GitHub Profile
@rrgarciach
rrgarciach / Dockerfile
Created Jun 11, 2018
Go HTTP server example
View Dockerfile
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 Aug 27, 2017 — 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.
View RaspberryPi-RFID
#!/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 Apr 16, 2017
Github profile loader with React
View github-cards-react.js
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>
View auth.service.js
'use strict';
angular.module('components.auth')
.provider('AuthSystemRoles', function () {
var roles = {
system : 'System User',
admin : 'Admin User',
account : 'Account Owner'
};
View authorized_route.js
(function () {
'use strict';
/* @ngInject */
function config($stateProvider, $urlRouterProvider, AuthSystemRolesProvider) {
var systemRoles = AuthSystemRolesProvider.$get().getSystemRoles();
$urlRouterProvider
.when('/pricing/', '/pricing');
$stateProvider
View errorhandler.service.js
// api service calling example
apiService.get()
.then(response => {
return response.data;
})
.catch(err => {
return errorHandler(err);
});
@rrgarciach
rrgarciach / pre-push.sh
Created Jul 19, 2016 — forked from vlucas/pre-push.sh
Prevent Pushes Directly to Master
View pre-push.sh
#!/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 Jun 18, 2016
This is the mediator guy ;D
View mediator-pattern.js
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 Jun 16, 2016
An Observer pattern example in JavaScript
View catAttack.js
function ObserverList(){
this.observerList = [];
}
ObserverList.prototype.add = function( obj ){
return this.observerList.push( obj );
};
ObserverList.prototype.count = function(){
return this.observerList.length;
View wsdl_example.xml
<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">