Skip to content

Instantly share code, notes, and snippets.

korczis / deferredRequest.js
Last active Aug 22, 2017
Deferred wrapper of cherio request
View deferredRequest.js
var deferred = require('deferred'),
request = require('request'),
cheerio = require('cheerio');
var deferredRequest = function(url) {
var d = deferred();
request(url, function (err, resp, body) {
if(err) {
d.reject(new Error("Unable to fetch '" + url + "', reason: " + err));
plentz / nginx.conf
Last active Oct 14, 2021
Best nginx configuration for improved security(and performance). Complete blog post here
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
aboma / ember.select2.js
Last active Feb 7, 2021
select2.js enabled select box view for ember.js
View ember.select2.js
// Select box utilizing Select2 functionality that overrides Ember.Select;
// Define view in the same way that you would an Ember.Select view.
// Additional attributes supported are: width, allowClear, and closeOnSelect;
// Example view:
// {{ view App.Select2
// viewName="fieldValueSelect2"
// prompt="Please select a value list"
// contentBinding="controller.fieldValuesLists"
// optionLabelPath=""
// optionValuePath=""
View apollo-aws.rb
#! /usr/bin/env ruby
require 'rubygems'
require 'fog'
require 'fileutils'
require 'yaml'
module Apollo
class AwsConsole
PRotondo / traceroute.hs
Last active Jul 30, 2017
Haskell traceroute over icmp
View traceroute.hs
#!/usr/bin/env runhaskell
-- Haskell traceroute over icmp
-- now with ByteString to avoid new errors produced
-- by the deprecated recvFrom from Network.Socket
import Control.Monad
import Data.Bits(complement)
import Data.ByteString(unpack,pack)
import Data.List
lukas-vlcek / gist:4673027
Last active Jan 19, 2021
Čeština v elasticsearch
View gist:4673027
# download
# unzip and start
cd elasticsearch-0.20.4
# remove data in case you have defined some analyzers in the past (e.g. stop/start)
rm -rf data/
ninjascience / Gruntfile.js
Created Jan 24, 2013
Gruntfile.js for testing with Jasmine and RequireJS and using Istanbul for coverage.
View Gruntfile.js
module.exports = function(grunt) {
'use strict';
// Project configuration.
meta : {
// Specify where our test files are. Once we get all the tests switched over we can use 'test/js/**/*.spec.js' to automatically load all tests.
specs : ['test/js/src/**/*.spec.js'],
bin : {
coverage: 'js/bin/coverage'
guerrerocarlos / main.js
Created Sep 6, 2012
loading using require.js
View main.js
// Require.js allows us to configure shortcut alias
// The shim config allows us to configure dependencies for
// scripts that do not call define() to register a module
shim: {
'socketio': {
exports: 'io'
'underscore': {
exports: '_'
bobbydavid / app.js
Created May 8, 2012 in Express 3
View app.js
var express = require('express')
, http = require('http')
, connect = require('connect')
, io = require('');
var app = express();
/* NOTE: We'll need to refer to the sessionStore container later. To
* accomplish this, we'll create our own and pass it to Express
* rather than letting it create its own. */
var sessionStore = new connect.session.MemoryStore();
jackdoe / rack-and-mongo.rb
Created Mar 6, 2012
mongoid stored rack session Rack::Session::RackAndMongo
View rack-and-mongo.rb
# inspired by
require 'rack/session/abstract/id'
class Session
include Mongoid::Document
field :sid
field :data
field :ts, type: Integer
index :sid, unique: true #dont forget Session.create_indexes
def Session.find_by_sid(sid)
Session.first(conditions: {sid: sid})