Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View laktek's full-sized avatar

Lakshan Perera laktek

View GitHub Profile
Verifying my Blockstack ID is secured with the address 1BStSSHb6QbagrSqSuWrX64yibNNdM8hd4 https://explorer.blockstack.org/address/1BStSSHb6QbagrSqSuWrX64yibNNdM8hd4
@laktek
laktek / server.js
Last active June 21, 2017 15:06 — forked from zellwk/server.js
const express = require('express')
const bodyParser = require('body-parser')
const expressValidator = require('express-validator')
const routes = require('./routes')
const middlewares = require('./middlewares')
const errorHandlers = require('./middlewares/errorHandlers')
const isProduction = process.env.NODE_ENV === 'production'
const passport = require('passport')
const mongoose = require('mongoose')
export default class App {
constructor(userHandler){
this.userHandler = userHandler;
}
async testing(req, res) => {
const { email } = req.body
const r = await this.userHandler.findOne({email})
res.json(r)
}
package main
import (
"fmt"
"net/http"
"time"
)
/*
* Converts a function that return a channel
var generate_tag_helpers_with_basepath = function(basePath) {
return {
relative_path: function() {
var pathDepth = basePath.split('/').length -2;
var path = new Array(pathDepth + 1).join('../');
return path;
}
}
};
@laktek
laktek / gist:1631290
Created January 18, 2012 05:48
Wikipedia SOPA protest unmask
// If you need to unmask the Wikipedia's SOPA protest blackout,
// paste this in your browser's address bar.
javascript:(function(d){d.getElementById('mw-sopaOverlay').style.display='none'; d.getElementById('content').style.display='block';})(document);
var my_function_expression = function(){};
var mocked = nodemock.mock("foo").takes(20, my_function_expression).calls(my_function_expression, 30, [10, 20])
@laktek
laktek / jquery.is_blank.js
Created December 29, 2010 06:38
Checks whether the given string (or object) is blank
(function($){
$.isBlank = function(string){
return(!string || $.trim(string) === "");
};
})(jQuery);
$.isBlank(" ") //true
$.isBlank("") //true
$.isBlank("\n") //true
$.isBlank("a") //false
/**
* jQuery plugin to detect clicks outside an element
*
* Copyright (c) 2010 Vesess Inc. (vesess.com)
* Licensed under the MIT (MIT-LICENSE.txt) licenses.
*
*/
(function($){
$.fn.outsideClick = function(optional_params){
/**
* jQuery plugin to detect clicks outside an element
*
* Copyright (c) 2010 Vesess Inc. (vesess.com)
* Licensed under the MIT (MIT-LICENSE.txt) licenses.
*
*/
(function($){
$.fn.outsideClick = function(optional_params){