Skip to content

Instantly share code, notes, and snippets.

View wbashir's full-sized avatar

Warsame Bashir wbashir

View GitHub Profile
//Using node-elasticsearch-client and meteor-npm
var ElasticSearchClient = Meteor.require('elasticsearchclient'),
url = Npm.require('url');
//local elastic search envrionment running on port 9200
// create an _opts object for remote systems with credentials: See ElasticSearch documentation
var serverOptions = {
host: 'localhost',
port: 9200,
@wbashir
wbashir / gist:7668685
Created November 27, 2013 00:18
WayPoints trigger on page holder bottom or when user scrolls to bottom of window
///Markup
<div id="st-container" class="st-container">
<div class=" fullscreen-container animated fadeInDown" id="fullscreen-container">
<div class=" custom_inner offset2" id="fullScreenAyahs">
<div class="pageHolder" id="">
</div>
<div class="pageHolder" id="">
</div>
@wbashir
wbashir / gist:7254053
Created October 31, 2013 17:55
Example
<div class="PlainText">
Date: 2013-10-28 20:00:43 -0500<br>
Source: Text<br>
Incident type: Text<br>
Incident detection rule: Text (ID=19762)<br>
Text: App - fard.com<br>
Text rating: 37<br>
Text: 171<br>
Description:&nbsp;Text d<br>
<br>
function setPresence (whereAt) {
Meteor.Presence.state = function() {
return {
online : true,
whereAt: whereAt
}
}
}
function trackPageview (path) {
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@wbashir
wbashir / gist:6416909
Created September 2, 2013 20:18
Template 'layout' is set as the default layout at the Router configure level.
<template name="layout">
{{yield 'header'}}
{{yield 'base'}}
<div class="content" id="content">
<div id="main-content">
{{yield 'mainContent'}}
@wbashir
wbashir / gist:6408451
Created September 2, 2013 01:20
Callback - Meteor update
Meteor.users.update({ _id: userID}, {
$set: {
createdAt: new Date()
}
}, false, true, function(err, result){
if(err)
console.log(err);
});
@wbashir
wbashir / gist:6408003
Created September 1, 2013 23:30
Controller - Extend so user is/isn't authorized with reactive computation.
MyController = RouteController.extend({
before: function () {
var onReady = function () {
if (/* whatever */)
this.render();
};
var onWait = function () {
// maybe show a loading or logging in function.
};
@wbashir
wbashir / gist:6401718
Created September 1, 2013 01:18
Base64 HMAC Encoding
def create_token():
message = bytes("Message")
secret = bytes("secret")
signature = base64.b64encode(hmac.new(secret, message, digestmod=hashlib.sha256).digest());
print(signature)
@wbashir
wbashir / gist:6399123
Created August 31, 2013 15:59
Scroll - Top IronRouter
Deps.autorun(function () {
var current = Router.current();
Deps.afterFlush(function () {
$('.content-inner').scrollTop(0);
$(window).scrollTop(0);
});
});