Skip to content

Instantly share code, notes, and snippets.

View jeserodz's full-sized avatar

Jese Rodriguez jeserodz

  • X-Team
  • Santiago, Dominican Republic
  • X @jeserodz
View GitHub Profile
@jeserodz
jeserodz / instagram-auth.js
Last active May 6, 2021 14:13
Instagram authentication with scopes permissions for Passport and Node.js.
// Node.js module to define an ExpressJS subrouter that handles requests
// to /auth path and uses passport to login using Instagram OAuth
var express = require('express');
var session = require('express-session');
var passport = require('passport');
var instagramStrategy = require('passport-instagram').Strategy;
// Require user model
var User = require('./user');
@jeserodz
jeserodz / mongo-express-config.js
Created January 22, 2016 14:22
Example config file for mongo-express
/*
This is an example config file for mongo-express (https://www.npmjs.com/package/mongo-express)
Should work without modifying if your mongodb server users are defaults
How to use:
1. Copy this file in your app/node_modules/mongo_express directory
2. Rename to config.js
*/
'use strict';
<!--
-- This is a pom.xml file with basic configuration for
-- Defining a project (groupId, artifactId, version packaging)
-- Defining dependencies
-- Defining build plugins
-- How to build and execute
-- $ mvn install
-- $ mvn compile
-- $ mvn package
@jeserodz
jeserodz / .htaccess
Created April 8, 2016 00:55
Enable CORS in Apache
# with AJAX withCredentials=false (cookies NOT sent)
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]]
# with AJAX withCredentials=true (cookies sent, SSL allowed...)
SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
@jeserodz
jeserodz / strip_html.js
Created April 8, 2016 01:18
JS Utils - Strips html tags from html code
// This functions strips html tags from html string
function strip(html) {
var tmp = document.createElement("DIV");
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || "";
}
@jeserodz
jeserodz / closures-examples.js
Last active May 30, 2016 00:41
JavaScript Examples: Closures
var closure1;
var closure2;
var buildFullName = function(fname, lname) {
// building full name inside the execution context
var fullName = fname + ' ' + lname;
// defining a function to return fullname according to execution context
var printFullName = function() {
@jeserodz
jeserodz / this-keyword-example.js
Last active May 30, 2016 10:31
JavaScript Examples: this Keyword
// This script demonstrates the 4 rules for how the parameter 'this' works.
// 'this' is passed to each function at the moment it is invoked, and is a
// reference to the object that invokes the function.
// Let's define a function which returns the value of 'this' for its eventual
// context
var fn = function() {
return this;
};
@jeserodz
jeserodz / iterm2-solarized.md
Created January 15, 2018 02:23 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm install && npm start -- --reset-cache
@jeserodz
jeserodz / launch_screen.xml
Created May 24, 2018 10:16
React Native (Android): launch_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/screen">
</LinearLayout>