Skip to content

Instantly share code, notes, and snippets.

View freekrai's full-sized avatar

Roger Stringer freekrai

View GitHub Profile
@freekrai
freekrai / about.md
Last active March 31, 2016 04:56
social login with angular and hello.js

How to use Hello.js and Angular to enable client-side social login.

  1. bower install to install bower dependencies.
  2. Setup a Facebook app
@freekrai
freekrai / elb-nodejs-ws.md
Created December 29, 2015 00:41 — forked from obolton/elb-nodejs-ws.md
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

@freekrai
freekrai / user.js
Last active December 21, 2015 21:47
// define the schema for our user model
var userSchema = mongoose.Schema({
local : {
email : String,
password : String,
resetPasswordToken: String,
resetPasswordExpires: Date
},
facebook : {
id : String,
@freekrai
freekrai / fluid_inbox_userscript.js
Created December 8, 2015 19:31
Userscript for Fluid App (http://fluidapp.com) to enable dock count and desktop notifications for Google Inbox
window.fluid.dockBadge = '';
// for tracking when to notify
var previousUnreadCount = 0;
// Main polling
var readyStateCheckInterval = setInterval(function() {
if(document.readyState === "complete") {
setInterval(updateDockBadge, 3000);
clearInterval(readyStateCheckInterval);
@freekrai
freekrai / google-inbox-userscript.js
Created December 8, 2015 05:41 — forked from aaronn/google-inbox-userscript.js
Google Inbox for Desktop (Fluid Userscript)
/* This is a FluidApp userscript for Google Inbox for Mac.
Includes options for total badge count and unread badge count.
1) You need the paid version of FluidApp (http://fluidapp.com/)
2) Point Fluid to https://inbox.google.com (I recommend the icon from here: https://medium.com/@chrismessina/create-an-icon-for-google-inbox-in-your-dock-ed269312e3bc)
3) Set the user-agent to Chrome
4) Go to window -> userscript and add click the plus sign under the first table (on the left). Name the item 'Inbox'.
5) In the second table (on the right) click the plus and type in "*inbox.google.com*".
6) Paste the contents of this document into the script area below that.
7) Configure badge count (for total or unread only) in the code below.
<?php
/* An easy way to keep in track of external processes.
* Ever wanted to execute a process in php, but you still wanted to have somewhat controll of the process ? Well.. This is a way of doing it.
* @compability: Linux only. (Windows does not work).
*/
class Process{
private $pid;
private $command;
public function __construct($cl=false){
@freekrai
freekrai / README.md
Created December 4, 2015 07:04 — forked from debashisbarman/README.md
A Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

#Creating a Twitter bot with Node.js Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

##Tools we need Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@freekrai
freekrai / include.js
Created November 20, 2015 07:43
include() - load scripts asynchronously w/375 bytes of code - e.g. `include(src, cb)`
function include(url,success) {
var head = document.getElementsByTagName("head")[0], done = false;
var script = document.createElement("script");
script.src = url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) {
done = true;
if (typeof success === 'function') success();
}
@freekrai
freekrai / basics-of-seo-external.md
Last active April 18, 2016 15:41 — forked from mattsandersuk/basics-of-seo-external.md
SEO Best Practice Guidelines

External SEO

External SEO is concerned primarily with how your website is being linked or referred to.

Backlink Profile

Your backlink profile plays a huge role in helping the search engine to understand the quality and trustworthiness of your site.

If a link is from a high quality website, it's likely to be seen as a vote of trust, likewise if the link or the linking website is of a low quality it can have a negative effect. So, with that in mind it's important to make sure where possible that your links are of as high quality as possible.

Links from external websites always play an important role in determining how valuable one website is in comparison to another. Where possible, it's recommended that any external links are altered to reference the new destination URLs. This will save a search engine having to go through a redirect before reaching their final destination, and can therefore mitigate negative effects of additional load speed, algorithmic damping, etc.

@freekrai
freekrai / wordpress-using-multisite-domain-mapping-on-a-mediatemple-grid-server.md
Created August 27, 2015 00:44
WordPress: Using multisite domain mapping on a mediatemple grid server

This won’t get into setting up multisite in wordpress, but it will help you set up multisite domain mapping on a grid server from media temple. If you need to see a good intro article on setting up multisite mode in wordpress, check this article out or this article for a good multisite .htaccess intro.

First, install WordPress MU Domain Mapping plugin, and follow the instructions for setting that up.

Now, to add a new domain to media temple that will show up on your site, the big catch is to redirect this domain to the existing main domain.

For example, originalsite.com is the main root domain, and I am going to create newsite.com.

  1. Add the domains you’d like to use (newsite.com in this example) as alternate domains in the AccountCenter.
  2. Log into your (gs) via SSH, move into the domains direc