Skip to content

Instantly share code, notes, and snippets.

View escaroda's full-sized avatar

Escaroda escaroda

View GitHub Profile
@escaroda
escaroda / slugify.js
Last active August 29, 2015 14:22 — forked from mathewbyrne/slugify.js
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@escaroda
escaroda / myview.js
Last active August 29, 2015 14:23 — forked from npaton/myview.js
// <canvas id="resizeCanvas" width="10000" height="10000" style="display:none"></canvas>
Template.myview.events({
"change .image-select": function(e, t) {
// Verify it's an image...
console.time("total");
var img = document.createElement("img");
img.src = window.URL.createObjectURL(e.currentTarget.files[0]);
img.onload = function () {

How to get facebook login working with Meteor and Cordova on iOS

Step 1: Make your local dev site internet accessible

Because there is an issue with OAuth2 login and localhost development, you currently have to deploy your meteor site to be able to test the Facebook login. A nice little workaround for this is to make the local instance of meteor accessible externally.

There is a great online guide for setting up port forwarding with your router and you can check your public external IP here.

For example, If you have an Apple router, simply open up Airport Utility on your Mac and click edit on your router, then go to the Network tab. Under Port Settings click the + icon and select Personal Web Sharing, setting all of the public and private ports to 3000. Make sure the private IP is set to your current computer IP.

# Note: if you want to run multiple meteor apps on the same server,
# make sure to define a separate port for each.
# Upstreams
upstream gentlenode {
server 127.0.0.1:58080;
}
# HTTP Server
server {
Slug = {};
// sourced from http://themeteorchef.com/recipes/slugged-routes/
Slug.slugify = function(value) {
// Take our passed value and format it using a series of regular expressions.
// The solution for this was derrived from a bit of experimentation and some
// information found here: http://bit.ly/1LtXYCn.
var formatted = value
// Take our passed value and convert it to lower case.
.toLowerCase()
@escaroda
escaroda / gist:7595c0d8ab4bf089fda2
Created August 3, 2015 08:14
Installing Image Magick on Ubuntu 14.04
sudo -i
cd
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzvf ImageMagick-6.8.9-1.tar.gz
cd ImageMagick-6.8.9-1/
./configure --prefix=/opt/imagemagick-6.8 && make
checkinstall
@escaroda
escaroda / iso_639-2.json
Last active August 29, 2015 14:26 — forked from franz-josef-kaiser/iso_639-2.json
ISO 639-2 JSON file that contains different international as well as local names for languages. The file is sorted by the ISO 639-2 language codes
{
"aar":
{
"int":["Afar"],
"native":["Afaraf"]
},
"aa":
{
"int":["Afar"],
"native":["Afaraf"]
@escaroda
escaroda / .gitignore
Last active September 11, 2015 10:33 — forked from karmi/.gitignore
Example Nginx configurations for Elasticsearch
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@escaroda
escaroda / nginx.conf
Last active September 15, 2015 17:31 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;