Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

carlos L cocodrino

🏠
Working from home
  • Venezuela
View GitHub Profile
@tracker1
tracker1 / MyComponent.jsx
Last active Jul 8, 2019
Simple pattern for loading async data with react, redux and redux-thunk middleware
View MyComponent.jsx
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);
View jwt-google-oauth2-service.js
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')
View Provider.dart
import 'package:flutter/widgets.dart';
class Provider extends StatefulWidget {
const Provider({this.data, this.child});
static of(BuildContext context) {
_InheritedProvider p =
context.inheritFromWidgetOfExactType(_InheritedProvider);
return p.data;
}
View config.json
{
"privateKey": "[PRIVATE_KEY]",
"publicKey": "[PUBLIC_KEY]",
"encryptionKey": "[ENCRYPTION_KEY]"
}
@cryzed
cryzed / fix-infinality.md
Last active Aug 15, 2022
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.
View fix-infinality.md

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 Jan 26, 2020
Package ClojureScript in a Native EXE
View example.sh
# 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 Sep 26, 2020
Twitter OAuth with node-oauth for node.js + express 4
View app.js
/*
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 Mar 30, 2022
A personal cheat sheet for running local Node project in a Docker container
View Docker shell commands.sh
# 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 Sep 28, 2021
Wait until all promises have completed even when some reject, with Promise.all
View PromisAllWithFails.js
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 Aug 2, 2022
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
View sshd.go
// 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: