Skip to content

Instantly share code, notes, and snippets.

😌

Iulia Maria Lungu iuliaL

😌
Block or report user

Report or block iuliaL

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iuliaL
iuliaL / server.js
Created Jan 14, 2016
node http.createServer
View server.js
// node server instead of xampp ;
var http = require('http');
var fs = require('fs');
http.createServer(function (request, response) {
var filePath = '.' + request.url;
console.log(request.url);
fs.readFile(filePath, function(error, content) {
response.writeHead(200);
@iuliaL
iuliaL / gulpfile.js
Created Feb 4, 2016
gulp basic structure
View gulpfile.js
var gulp = require("gulp"),
concat= require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
maps = require('gulp-sourcemaps'),
del = require('del'); // ATTENTION!!! NODE MODULE - NOT GULP run in terminal: npm install del --save-dev
//_________________________________________________________________________concatenate all js files
View gist:b13ac1f898fc9735da69
'use strict';
var weeks = $('input.weeks');
var hours = $('input.hours');
var weekSelect = $('span.week-select');
var costEstimation = $('span.cost');
var price = 14;
var cost;
var counter = 0;
View expressREST.js
var express = require('express');
var fs = require('fs');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
var events = JSON.parse(fs.readFileSync("data.json",'utf8'));
var counter = Object.keys(events).length;
@iuliaL
iuliaL / getSet.js
Created Aug 24, 2016
Getters and Setters in ES6
View getSet.js
'use strict';
class Student {
constructor({ firstName, lastName, age, interestLevel = 5 } = {}) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.interestLevel = interestLevel;
}
get name(){
@iuliaL
iuliaL / closure.js
Last active Sep 16, 2016
closure structure
View closure.js
function outerFunction(){
var someCount = 0;
return function innerFunction(){
someCount++;
console.log("Called ",someCount," times");
}
}
var counter = outerFunction();
counter(); // "Called 1 times"
View gist:037bd14fdd686ed85a143f79d2adb551
function validateEmail(email) {
return /.+@.+/.test(email);
}
$("form").on("submit", function(event){
var inputArray = $(this).find("input");
var valid = true;
inputArray.each(function(index,input){
if(input.attr("required") !== undefined && !input.val()){
@iuliaL
iuliaL / gist:ac9ebd4dbec8b6d416560c5d567bbd9d
Created Oct 24, 2016
git-project-dev-activity-log-cmd
View gist:ac9ebd4dbec8b6d416560c5d567bbd9d
git log --shortstat --pretty="%cE" | sed 's/\(.*\)@.*/\1/' | grep -v "^$" | awk 'BEGIN { line=""; } !/^ / { if (line=="" || !match(line, $0)) {line = $0 "," line }} /^ / { print line " # " $0; line=""}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/\1 0 insertions\(+\), \2/;s/\(\+\)$/\(\+\), 0 deletions\(-\)/;s/insertions?\(\+\), //;s/ deletions?\(-\)//' | awk 'BEGIN {name=""; files=0; insertions=0; deletions=0;} {if ($1 != name && name != "") { print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net"; files=0; insertions=0; deletions=0; name=$1; } name=$1; files+=$2; insertions+=$3; deletions+=$4} END {print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net";}'
@iuliaL
iuliaL / XmasTree.js
Last active Oct 28, 2016
Function that logs a Xmas tree :)
View XmasTree.js
function calcWhiteSpaces(limit) {
var whitespace = " ";
for ( var i= 0 ; i < limit ; i++){
whitespace += " "
}
return whitespace;
}
function calcBranchWidth(limit) {
var draw = "";
View _mixins.sass
=text-elipsis
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
display: block // optional
=filter($filter)
-webkit-filter: $filter /* Ch 23+, Saf 6.0+, BB 10.0+ */
filter: $filter /* FF 35+ */
You can’t perform that action at this time.