Skip to content

Instantly share code, notes, and snippets.

View onel0p3z's full-sized avatar
🏠
Working from home

Juan Lopez onel0p3z

🏠
Working from home
View GitHub Profile
@onel0p3z
onel0p3z / image-getter.js
Created April 24, 2013 23:12
Parses HTML files in folder "Templates", looks for IMG tags, gets SRC attribute, and downloads images to current folder. Not the best way but it worked for me. Also can create a file with links of images. //TIPS from http://maxogden.com/scraping-with-node.html
var $ = require('cheerio'),
_ = require('underscore'),
request = require('request'),
// If you want to create a file
images = [],
path = require('path'),
dir = path.join(__dirname,'\Templates'),
fs = require('fs'),
GetImage = function(file){
var HtmlFile = fs.readFileSync(file).toString(),
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 13, 2024 10:59
A badass list of frontend development resources I collected over time.
@julianduque
julianduque / db.js
Last active December 21, 2015 11:29 — forked from anonymous/db.js
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/app');
var usrSchema = new mongoose.Schema({
user: { type: String, required: true },
password: { type: String, required: true },
DLU: { type: Date }
});
@frytaz
frytaz / gist:7037771
Last active December 25, 2015 20:49
Ghost node.js blogging platform password reset script
var bcrypt = require('bcrypt-nodejs'),
sqlite3 = require('sqlite3').verbose();
var file = 'content/data/ghost-dev.db';
var db = new sqlite3.Database(file);
var password = 'YOUR_NEW_PASSWD';
bcrypt.hash(password, null, null, function(err, hash) {
db.serialize(function() {
db.run("UPDATE users SET password = ? WHERE id = ?", hash, 1);
@tj
tj / config.js
Last active December 27, 2015 14:49
/**
* Module dependencies.
*/
var pkg = require('../package');
var env = process.env.NODE_ENV || 'development';
/**
* Return setting `name`.
*
@creationix
creationix / path.js
Created November 12, 2013 18:10
Simple path join and dirname functions for generic javascript
// Joins path segments. Preserves initial "/" and resolves ".." and "."
// Does not support using ".." to go above/outside the root.
// This means that join("foo", "../../bar") will not resolve to "../bar"
function join(/* path segments */) {
// Split the inputs into a list of path commands.
var parts = [];
for (var i = 0, l = arguments.length; i < l; i++) {
parts = parts.concat(arguments[i].split("/"));
}
// Interpret the path commands to get the new resolved path.
@Btibert3
Btibert3 / rmongodb-tutorial.md
Last active November 8, 2021 01:13
Basic Overview of using the rmongodb package for R.

rmongodb Tutorial

This is a quick document aimed at highlighting the basics of what you might want to do using MongoDB and R. I am coming at this, almost completely, from a SQL mindset.

Install

The easiest way to install, I believe, is

@lrvick
lrvick / app.js
Last active April 26, 2024 13:06
AngularJS credit card form with validation
// MIT: http://opensource.org/licenses/MIT
angular.module('app', []);
angular.module('app').controller
( 'MainCtrl'
, function($scope,$locale) {
$scope.currentYear = new Date().getFullYear()
$scope.currentMonth = new Date().getMonth() + 1
$scope.months = $locale.DATETIME_FORMATS.MONTH
@bobholt
bobholt / resources.md
Last active August 8, 2022 21:03
Roost Resources
@mikaelbr
mikaelbr / destructuring.js
Last active April 25, 2024 13:21
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];