Skip to content

Instantly share code, notes, and snippets.

View J-C-L-G's full-sized avatar

JCLG J-C-L-G

  • San Francisco, CA.
View GitHub Profile
@J-C-L-G
J-C-L-G / comment-example.js
Created November 4, 2020 23:14 — forked from brandongoode/comment-example.js
Dynamoose range and hash key example
var commentSchema = new Schema({
postId: {
type: String,
hashKey: true
},
id: {
type: String,
rangeKey: true,
default: shortId.generate
@J-C-L-G
J-C-L-G / deleteAvatar.js
Created July 24, 2020 17:58 — forked from SylarRuby/deleteAvatar.js
Deletes a s3 bucket object by a known unique key 💥
/**
* Delete an image from the S3 Bucket
*
* @author Daveyon Mayne <@MirMayne>
* @date July 14th 2019
*/
const AWS = require('aws-sdk');
const deletePhoto = async (avatar_url) => {
@J-C-L-G
J-C-L-G / userAvatar.js
Created July 24, 2020 17:58 — forked from SylarRuby/userAvatar.js
NodeJs AWS S3 Upload
/**
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from
* a base64 string.
* Updated to use Promise (bluebird)
* Web: https://mayneweb.com
*
* @param {string} base64 Data
* @return {string} Image url
*/
const imageUpload = async (base64) => {
@J-C-L-G
J-C-L-G / gist:4ccda3fe11af7749deab41b15366be58
Created July 21, 2020 00:37 — forked from imranity/gist:9246dd195f785cf4783d
How to solve "sudo: no tty present and no askpass program specified" when trying to run a shell from Jenkins
Running shell scripts that have contain sudo commands in them from jenkins might not run as expected. To fix this, follow along
Simple steps:
1. On ubuntu based systems, run " $ sudo visudo "
2. this will open /etc/sudoers file.
3. If your jenkins user is already in that file, then modify to look like this:
jenkins ALL=(ALL) NOPASSWD: ALL
4. save the file by doing Ctrl+O (dont save in tmp file. save in /etc/sudoers, confirm overwrite)
5. Exit by doing Ctrl+X
6. Relaunch your jenkins job
@J-C-L-G
J-C-L-G / nginx.conf
Created September 15, 2019 06:06 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@J-C-L-G
J-C-L-G / gist:99bf9282b12531c243c7af1a0ec1e03c
Created October 14, 2018 17:59
Medium Code Article Sample
// 1. Por Defecto - Funcion ejecutada como “funcion”.
function regresaMiContexto(){
return this;
}
function regresaMiContextoEnModoEstricto(){
'use strict';
return this;
}
@J-C-L-G
J-C-L-G / sane-caching.nginx.conf
Created June 16, 2018 05:52 — forked from philipstanislaus/sane-caching.nginx.conf
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@J-C-L-G
J-C-L-G / node-cluster-messaging.js
Created November 19, 2016 01:12 — forked from jpoehls/node-cluster-messaging.js
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.