Skip to content

Instantly share code, notes, and snippets.

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

carlos L cocodrino

🏠
Working from home
  • Venezuela
View GitHub Profile
@tracker1
tracker1 / MyComponent.jsx
Last active July 8, 2019 12:48
Simple pattern for loading async data with react, redux and redux-thunk middleware
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import * as Actions from './action';
const mapStateToProps = ({ loaded, loading, error, data }) = ({ loaded, loading, error, data });
const mapDispatchToProps = dispatch => ({ action: bindActionCreators(Actions, dispatch) });
export class MyComponent extends Component {
load = _ => this.props.action.load(this.props.id);
require('dotenv').config()
const cors = require('cors')
const bodyParser = require('body-parser')
const express = require('express')
const expressJwt = require('express-jwt')
const cookieSession = require('cookie-session')
const jwt = require('jsonwebtoken')
const passport = require('passport')
const GoogleStrategy = require('passport-google-oauth20').Strategy
const jwtSecret = Buffer.from('Zn8Q5tyZ/G1MHltc4F/gTkVJMlrbKiZt', 'base64')
@retrohacker
retrohacker / config.json
Created March 30, 2017 18:01
storj-fuse
{
"privateKey": "[PRIVATE_KEY]",
"publicKey": "[PUBLIC_KEY]",
"encryptionKey": "[ENCRYPTION_KEY]"
}
@cryzed
cryzed / fix-infinality.md
Last active January 19, 2024 08:56
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@candera
candera / example.sh
Last active January 26, 2020 00:43
Package ClojureScript in a Native EXE
# Update: This micro-blog is now also a guide on clojurescript.org:
# http://clojurescript.org/guides/native-executables
# Hello! This is a micro-post about how to produce native executables
# from ClojureScript source. The basic idea is to produce a
# JavaScript file using the ClojureScript compiler, and then use a
# Node.js tool called nexe (https://github.com/jaredallard/nexe) to
# compile that into an executable. The resulting file can be run
# without requiring a node install on the target machine, which can
# be handy.
@JuanJo4
JuanJo4 / app.js
Last active September 26, 2020 21:53
Twitter OAuth with node-oauth for node.js + express 4
/*
Node.js, express, oauth example using Twitters API
Install Dependencies:
npm install express
npm install oauth
Create App File:
Save this file to app.js
@bahmutov
bahmutov / Docker shell commands.sh
Last active February 9, 2024 07:55
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@nhagen
nhagen / PromisAllWithFails.js
Last active November 15, 2022 18:11
Wait until all promises have completed even when some reject, with Promise.all
var a = ["sdfdf", "http://oooooolol"],
handleNetErr = function(e) { return e };
Promise.all(fetch('sdfdsf').catch(handleNetErr), fetch('http://invalidurl').catch(handleNetErr))
.then(function(sdf, invalid) {
console.log(sdf, invalid) // [Response, TypeError]
})
.catch(function(err) {
console.log(err);
})
@jpillora
jpillora / sshd.go
Last active December 17, 2023 16:27
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@Jonplussed
Jonplussed / monadic_builtins.rs
Last active August 29, 2015 14:06
Add applicative `fmap` and monadic `bind` to Rust's builtin enums
trait MonadicOpt<T> {
fn fmap<U>(self, f: |T| -> U) -> Option<U>;
fn bind<U>(self, f: |T| -> Option<U>) -> Option<U>;
}
impl<T> MonadicOpt<T> for Option<T> {
fn fmap<U>(self, f: |T| -> U) -> Option<U> {
match self {
Some(x) => Some(f(x)),
_ => None,