Skip to content

Instantly share code, notes, and snippets.

View Deviad's full-sized avatar

Davide P. Deviad

View GitHub Profile
@Deviad
Deviad / custom.js
Last active March 31, 2016 18:16
jQuery with Modular OOP design pattern (it's a working example)
var Custom = {
showHideSearch: function(boolVal) {
var onOff = boolVal;
if (onOff == 'on') {
jQuery(function() {
jQuery('#search-icon').click(function() {
var jtheinputselector = jQuery('input#search');
if (!jtheinputselector.hasClass('active')) {
jQuery('#top-menu > #md-menu').css({
'z-index': '10'
@Deviad
Deviad / app.component.ts
Created April 17, 2016 09:40
Two way Data Binding Example
import {Component} from 'angular2/core';
import {PropertyBindingComponent} from "./property-binding.component";
@Component({
selector: 'app',
template: `
<section class="parent">
<h2>This is the parent component</h2>
<h4>Please, enter your name:</h4>
<input type="text" [(ngModel)]="name">
<br><br>
<?php
namespace Db;
class DbMgmt
{
const SERVERNAME = 'localhost';
const PORT = "3306";
const USERNAME = 'root';
<?php
/**
* @author Davide Pugliese
* @uses PDO
*
* This is a little engine to run queries the smart way.
*
*/
<?php
namespace Entity;
use Db\DbObj;
class FormField
{
public $the_table;
<?php
namespace App\Controller;
use App\Db\DbMgmt;
use App\Db\DbObj;
use App\Entity\Answer;
use App\Entity\FormField;
use App\Entity\User;
<?php
namespace App\Db;
class DbMgmt
{
const SERVERNAME = 'localhost';
const PORT = "3306";
const USERNAME = 'root';
<?php
namespace App\Db;
class DbMgmt
{
const SERVERNAME = 'localhost';
const PORT = "3306";
const USERNAME = 'root';
@Deviad
Deviad / app.ts
Created March 31, 2017 13:08
Read a JSON asynchronously and create an observable out of it.
/**
* Created by Davide Pugliese on 26/02/17.
*/
import {Observable, Subscribable} from "rxjs/Observable";
import "rxjs/add/observable/from";
import "rxjs/add/observable/fromPromise";
import "rxjs/add/observable/of";
import "rxjs/add/operator/map";
import "rxjs/add/observable/defer";
@Deviad
Deviad / linkedin.data.service.ts
Created April 1, 2017 10:47
Issue with createCookie it returns undefined as if it cannot find the file cookies.json.
/**
* Created by Davide Pugliese on 26/02/17.
*/
import { Observable } from "rxjs/Observable";
import "rxjs/add/observable/from";
let request = require('request');
import { userObservable } from "./user.service";
import {first} from "rxjs/operator/first";
import {last} from "rxjs/operator/last";