Skip to content

Instantly share code, notes, and snippets.

View freekrai's full-sized avatar

Roger Stringer freekrai

View GitHub Profile
@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 / 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

<?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 / 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.
@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 / 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 / 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 / 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
while true; do for i in 02E{{9..5},{6..8}}; do printf "\u${i}O=o>";sleep 0.09;printf "\b\b\b\b\b";done;printf "_";done
@freekrai
freekrai / codefish.md
Created January 7, 2016 20:47
<')))>{

<')))>{