Skip to content

Instantly share code, notes, and snippets.

View jonathanwork's full-sized avatar

Jonathan Lopez jonathanwork

View GitHub Profile
@jonathanwork
jonathanwork / js
Created April 21, 2016 21:57
this gives results to pangrams
//creator Jonathan R. Lopez
var write = function(inputString) {
process.stdout.write(inputString);
}
var test = function() {
return 'has test'
}
var checkingAlphabet = function(result) {
//var checkResult = !result ? null : result;
hasAlphabet = /^[a-z]$/i;
function processData(input) {
//creator Jonathan R. Lopez
var write = function(inputString) {
process.stdout.write(inputString);
}
var test = function() {
return 'has test'
}
var checkingAlphabet = function(result) {
//var checkResult = !result ? null : result;
@jonathanwork
jonathanwork / .vimrc
Created April 29, 2016 06:44
vim file to see tabs on files
:set list
:set listchars=tab:\|\<Space>
@jonathanwork
jonathanwork / focus_event_directive.html
Created May 4, 2016 05:55
simple angular event directive
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Angular Focus Event Directive</title>
</head>
<body>
<div ng-controller="myController">
<h2>Focus Event Directive</h2>
Input 1: <br>
@jonathanwork
jonathanwork / proxy-stream.js
Created May 12, 2016 03:32
proxy-stream.js
var port = 8080,
fs = require("fs"),
http = require("http"),
server = http.createServer()
function forEachLine(chunks, callback) {
var buffer = chunks.join("")
buffer.substr(0, buffer.lastIndexOf("\n")).split("\n").forEach(callback)
return buffer.substr(buffer.lastIndexOf("\n") + 1).split("\n")
}
@jonathanwork
jonathanwork / creatingElements.js
Created June 26, 2016 20:18
this a simple way of creating element in js
//appending elements in js....
function createElements(element, attr, inner) {
//checkes whether the user has logged in an element
if(typeof(element) === 'undefined') return false;
//checks whether the user has logged in an inner link
if(typeof(inner) === 'undefined') return inner = 'undefined';
//if ok the element is created
var el = document.createElement(element);
@jonathanwork
jonathanwork / google.js
Created October 3, 2016 02:23 — forked from khilnani/google.js
Phantom.js script to take screenshots of a google search result
#!/usr/bin/env phantomjs
//--------------------------------------------------------
var page = require('webpage').create(),
system = require('system'),
action = null,
q = null;
//--------------------------------------------------------
@jonathanwork
jonathanwork / gulpfile.js
Created December 25, 2016 23:32
reallly helpful gist to use with hapi and gulpfile with browserSync and nodemon
/**
* Module Dependencies
*/
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var nodemon = require('gulp-nodemon');
var g_sass = require('gulp-sass');
var pug = require('gulp-pug');
@jonathanwork
jonathanwork / lookinCollections.js
Created January 3, 2017 05:24
this will look into all your collections within mongoDB
var collections = db.getCollectionNames();
for(var i = 0; i< collections.length; i++){
print('Collection: ' + collections[i]); // print the name of each collection
db.getCollection(collections[i]).find().forEach(printjson); //and then print the json of each of its elements
}