Skip to content

Instantly share code, notes, and snippets.

View felipekm's full-sized avatar
🦈

Felipe Kautzmann felipekm

🦈
View GitHub Profile
@bennadel
bennadel / friends.js
Created September 17, 2013 01:38
Getting Started With MongoLab And The MongoDB Shell
// Clear any existing data from the friends collection.
db.friends.remove();
print( "> Friends collection has been reset." );
// Set up the randomly genreated friends.
var names = [
"Tricia", "Joanna", "Kim", "Anne", "Libby",
"Sarah", "Kate", "Kristina", "Samantha", "Tina"
];
'use strict';
const Module = require('module');
const originalCompile = Module.prototype._compile;
const nohook = function (content, filename, done) {
return done(content);
};
let currentHook = nohook;
@rdsubhas
rdsubhas / generators.js
Last active May 2, 2017 19:32
es6-blog-generators.js
var Promise = require('bluebird');
var request = Promise.promisifyAll(require('request'));
var url1='http://httpbin.org/', url2=url1, url3=url1, url4=url1;
function* foo() {
var res1 = yield request.getAsync(url1);
var res2 = yield request.getAsync(url2);
var res3 = yield request.getAsync(url3);
var res4 = yield request.getAsync(url4);
return "whew all done";
// Routing setup
.config(function ($routeProvider) {
$routeProvider
.when('/home', {
controller: 'homeCtrl',
templateUrl: 'home.tpl.html'
}).when('/users', {
controller: 'usersCtrl',
controllerAs: 'vm',
templateUrl: 'users.tpl.html',
@bennadel
bennadel / index.htm
Created September 17, 2012 15:21
Capturing Document-Click Events With AngularJS
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>Capturing Document-Clicks In AngularJS</title>
</head>
<body
ng-controller="DemoController"
bn-document-click="handleClick( $event )">
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
# (if you're backing up a user's repos instead, this should be your GitHub username)
GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API)
GHBU_PASSWD=${GHBU_PASSWD-"<CHANGE-ME>"} # the password for that account
GHBU_GITHOST=${GHBU_GITHOST-"github.com"} # the GitHub hostname (see comments)
GHBU_PRUNE_OLD=${GHBU_PRUNE_OLD-true} # when `true`, old backups will be deleted
@felipekm
felipekm / rhel-nodejs-config.sh
Last active July 22, 2020 19:30
RHEL NodeJS Server Pre Config
# NGINX | GIT
sudo yum install -y nginx git
# Install the current version of node version manager (nvm) by typing the following at the command line to install version 33.6
# currently using v0.35.2
curl -o- https://raw.githubusercontent.com/creationix/nvm/{VERSION}/install.sh | bash
# Activate nvm by typing the following at the command line.
. ~/.nvm/nvm.sh
@EpokK
EpokK / ngEnter.js
Last active January 7, 2022 13:57
ngEnter directive if you can use submit form(https://twitter.com/ririlepanda)
app.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) {
scope.$apply(function(){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
@getify
getify / gist:7ae82fdc2e86bf66bcba
Last active March 27, 2022 19:50
List of ES6 books either out or in progress...