Skip to content

Instantly share code, notes, and snippets.

View fizerkhan's full-sized avatar

Fizer Khan (பைசர் கான்) fizerkhan

View GitHub Profile
@bnagy
bnagy / searchers.rb
Created August 22, 2012 09:17
threadsafe search engine automation
require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'
Capybara.configure do |config|
config.run_server = false
config.default_driver = :poltergeist
end
module Searchers
@yurique
yurique / gist:3427081
Created August 22, 2012 16:08
java version
class Person {
private String firstName;
private String lastName;
private Address address;
public Person() {
}
public Person(String firstName, String lastName, Address address) {
this.firstName = firstName;
this.lastName = lastName;
this.address = address;
@rvause
rvause / batterywatch.py
Created August 22, 2012 16:50
Simple script to make my computer beep at me when its about to die without battery
#!/usr/bin/env python
import subprocess
import time
import shlex
import re
percent = 100
@johnmcdowall
johnmcdowall / CORS Configuration
Created December 6, 2012 18:32 — forked from cyberwombat/CORS Configuration
JQuery file upload plugin (blueimp) with NodeJs Express3 directly to Amazon S3 with public access
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
@dirkk0
dirkk0 / gist:4530915
Last active December 11, 2015 02:29
Installing Telescope ( https://github.com/SachaG/Telescope)
# https://github.com/SachaG/Telescope
########################
# it should be
sudo apt-get install git npm
curl https://install.meteor.com | /bin/sh
sudo npm install -g meteorite
@machadogj
machadogj / MyClass.js
Created April 5, 2013 20:59
Sample code for understanding error handling in node.js.
var util = require('util'),
EventEmitter = require('events').EventEmitter;
var MyClass = function () {
if (!(this instanceof MyClass)) return new MyClass();
EventEmitter.call(this);
};
@jeffwhelpley
jeffwhelpley / gist:6059715
Last active December 20, 2015 02:58
This is a design spec for a configuration-based Node.js NoSql security access library.

Node.js CRUD Configurator

The past 2 months I have been focused almost exclusively on building a new, exciting product for GetHuman. I am using the MEEAN stack (i.e. MongoDB Express.js ElasticSearch AngularJS Node.js), which basically means doing a boat load of JavaScript development. As someone who has done a lot of JavasScript development can tell you, there are a ton of open source libraries out there that can help speed your development and improve the quality of your code.

In fact, there are so many great libraries out there that I am always surprised when I can't find a good one for something that I think is a common problem. One such problem came up a couple weeks ago and I was inspired to create a solution which I hope to turn into a new open source library.

Problem

When an API is exposed with multiple roles and perhaps even multiple permission levels within each role, it takes a decent amount of code to properly control security access. For example, here are some examples of role based secu

@BenHall
BenHall / passport.js
Created February 29, 2012 14:48
passport.js auth route
exports.ensureAuthenicated = function(req, res, next) {
if (req.isAuthenticated()) { return next(); }
res.redirect('/login')
}
@tbjers
tbjers / menu.js
Created September 3, 2012 17:12
Express resources with authentication middleware
module.exports = {
menu: {
'wall': { title: 'Wall', name: 'wall' },
'logs': { title: 'Logs', name: 'logs', submenu: {
'system': { title: 'System', name: 'system' }
} },
'stats': { title: 'Stats', name: 'stats' },
'admin': { title: 'Admin', name: 'admin', submenu: {
'users': { title: 'Users', name: 'users' },
'grants': { title: 'Grants', name: 'grants' }