Skip to content

Instantly share code, notes, and snippets.

@derMani
derMani / GridStream.js
Last active Sep 5, 2020 — forked from psi-4ward/GridStream.js
NodeJS MongoDB-GridFS Video range stream exampleLets your browser seek/jump wihin the video-playback.
View GridStream.js
var express = require('express');
var app = express();
var mongo = require('mongodb');
var MongoClient = require('mongodb').MongoClient;
var GridStore = mongo.GridStore;
var ObjectID = require('mongodb').ObjectID;
function StreamGridFile(req, res, GridFile) {
@sebmarkbage
sebmarkbage / Enhance.js
Last active Nov 20, 2020
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
View gist:b40fba563919f88c322c
cd hoodie-plugin-chat && npm link && cd .. &&
cd hoodie-plugin-cordovafb && npm link && cd .. &&
cd hoodie-plugin-image && npm link && cd .. &&
cd hoodie-plugin-notification && npm link && cd .. &&
cd hoodie-plugin-oauthio && npm link && cd .. &&
cd hoodie-plugin-paranoia && npm link && cd .. &&
cd hoodie-plugin-profile && npm link && cd .. &&
cd hoodie-plugin-pubsub && npm link && cd .. &&
cd hoodie-plugin-socialmedia && npm link && cd .. &&
cd hoodie-utils-plugins && npm link && cd ..
@craigsnyders
craigsnyders / logging.js
Created Apr 11, 2013
Async logging in Node.JS – JUST CHILL, WINSTON.
View logging.js
var winston = require('winston');
var fs = require('fs');
fs.mkdir('./logs', function(err) {
if (err) throw err;
});
// Define levels to be like log4j in java
var customLevels = {
levels: {
@joaoneto
joaoneto / login.test.js
Created Mar 13, 2013
Login session test with mocha
View login.test.js
var request = require('supertest'),
should = require('should'),
app = require('../server');
var Cookies;
describe('Functional Test <Sessions>:', function () {
it('should create user session for valid user', function (done) {
request(app)
.post('/v1/sessions')
@justinvw
justinvw / es_simple_autocomplete_example_config.sh
Last active Nov 27, 2020
Simple ElasticSearch autocomplete example configuration. The 'autocomplete' functionality is accomplished by lowercasing, character folding and n-gram tokenization of a specific indexed field (in this case "city").
View es_simple_autocomplete_example_config.sh
# Delete the possibly existing autocomplete test index
curl -X DELETE localhost:9200/autocomplete_test
# Put the config of the autocomplete index
curl -X PUT localhost:9200/autocomplete_test -d '
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
@joaoneto
joaoneto / .bashrc_ps1
Last active Dec 13, 2015
Put .bashrc_ps1 in your home (~/) and at the end of your .bashrc add follow lines: if [ -f ~/.bashrc_ps1 ]; then . ~/.bashrc_ps1 fi
View .bashrc_ps1
# Put .bashrc_ps1 in your home (~/) and at the end of your .bashrc add follow lines:
# if [ -f ~/.bashrc_ps1 ]; then
# . ~/.bashrc_ps1
# fi
RED='\[\e[0;31m\]'
BRED='\[\e[1;31m\]'
BLUE='\[\e[0;34m\]'
BBLUE='\[\e[1;34m\]'
CYAN='\[\e[0;36m\]'
@joaoneto
joaoneto / changelog.php
Last active Dec 11, 2015
Transform GIT LOG into a cute format Changelog.md
View changelog.php
<?php
/**
* Changelog Markdown
*
* This is a script to transform GIT LOG into a cute format Changelog.md
*
* To use, set executable permissions to this file and execute:
* $ php changelog.php > CHANGELOG.md
*
* Copyright (c) 2014 João Pinto Neto
@maxogden
maxogden / readme.md
Last active Jun 3, 2020
automatically scan for and join open internet enabled wifi networks on linux using node.js (tested on raspberry pi raspbian)
View readme.md
@ryanjbonnell
ryanjbonnell / gist:3880048
Last active Jul 9, 2020
Install Memcache on Mac OS X 10.8 "Mountain Lion"
View gist:3880048
# memcached requires libevent
cd /usr/local/src
curl -L -O http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
tar -xvzf libevent-2.0.17-stable.tar.gz
cd libevent-2.0.17-stable*
./configure
make
sudo make install
# Compile memcached utility
You can’t perform that action at this time.