Skip to content

Instantly share code, notes, and snippets.

View alfonsodev's full-sized avatar
🏠
Working from home

Alfonso alfonsodev

🏠
Working from home
View GitHub Profile
@billhathaway
billhathaway / gist:e32060b96802d74ca586
Created December 23, 2014 18:35
Getting IronMQ on-premise running in Vagrant
# more detailed instructions are at http://dev.iron.io/mq-onpremise/getting_started
# Get a coreos VM up
git clone https://github.com/coreos/coreos-vagrant.git
cd coreos-vagrant/
vagrant up
# get into the coreos box
vagrant ssh
@slamus
slamus / .babelrc
Last active May 2, 2016 11:13
My react-native Jest configuration
{
"presets": ["react-native"]
}
@alfonsodev
alfonsodev / gist:10597209
Created April 13, 2014 18:56
gandi.net ssl https
Gandi.net ssl certificate working with haproxy
In one file concatenate the certifcate with the private key (domain.pem in the example)
In other file just the intermediate ceritificate (gandi.ca.pem in the example) then in your haproxy.cfg
bind *:443 ssl crt /home/.ssh/domain.pem ca-file /home/.ssh/gandi.ca.pem
frontend https-in
bind *:443 ssl crt /home/.ssh/domain.pem ca-file /home/.ssh/gandi.ca.pem
timeout client 1h
@vmadman
vmadman / logstash-supervisord
Created April 27, 2013 06:48
An example SupervisorD configuration for all three logstash components. Some of it might look obvious, but it took a ton of tweaking to figure it out. (but I might just be dumb)
[program:lss]
process_name=Shipper
command=java -jar /usr/local/logstash/bin/logstash-1.1.9-monolithic.jar agent --config /usr/local/logstash/conf/shipper.conf --log /usr/local/logstash/log/shipper.log
user=logstash
startretries=3
redirect_stderr=true
std_out_logfile=NONE
startsecs=3
environment=HOME="/usr/local/logstash/"
@alfonsodev
alfonsodev / action-creator-vs-reducer.md
Created October 22, 2017 11:13 — forked from kof/action-creator-vs-reducer.md
Action creator vs. reducer

When should you use action creator and when reducer?

Action creator

  • you need to have side effects
  • you need to read from store to decide what to do
  • you need to dispatch more than one action
  • action produced by action creator needs to contain all the data reducer can need to shape the components state

Reducer

  • should not have any side effects
@shirou
shirou / main.go
Last active March 4, 2018 10:19
ansible module written in go-lang. This is almost same as http://ansible.cc/docs/moduledev.html#reading-input
package main
import (
"fmt"
"os"
"io/ioutil"
"strings"
"time"
"encoding/json"
)
@adrianmoses
adrianmoses / goquery-example.go
Last active April 20, 2018 03:13
goquery example
package main
/*
* Script that scrapes google front page
* Usage: ./google [<query>]
* e.g. ./google hacker news
*/
import (
"fmt"
// Retry 5 times with waiting for 2 seconds
function* updateApi(data) {
for(let i = 0; i < 5; i++) {
try {
const apiResponse = yield call(apiRequest, { data });
return apiResponse;
} catch(err) {
if(i < 4) {
yield call(delay, 2000);
}
@rampicos
rampicos / social.js
Last active January 10, 2019 10:10
Social.js is the Appcelerator Titanium's Alloy Widget at first it is used to connect with Twitter only, though twitter and linkedin uses OAuth for its authentication I made some changes on Social.js for multi-purpose to connect Twitter and LinkedIn
function hex_sha1(s) {
return binb2hex(core_sha1(str2binb(s), s.length * chrsz));
}
function b64_sha1(s) {
return binb2b64(core_sha1(str2binb(s), s.length * chrsz));
}
function str_sha1(s) {
return binb2str(core_sha1(str2binb(s), s.length * chrsz));
@kof
kof / action-creator-vs-reducer.md
Last active January 18, 2020 09:06
Action creator vs. reducer

When should you use action creator and when reducer?

Action creator

  • you need to have side effects
  • you need to read from store to decide what to do
  • you need to dispatch more than one action
  • action produced by action creator needs to contain all the data reducer can need to shape the components state

Reducer

  • should not have any side effects