Skip to content

Instantly share code, notes, and snippets.

View johndavedecano's full-sized avatar
🏠
Working 🇳🇱

John Dave Decano johndavedecano

🏠
Working 🇳🇱
View GitHub Profile
@johndavedecano
johndavedecano / CSV_Parser.php
Created July 17, 2012 17:10
CSV to HTML Table, MYSQL, JSON and Array
<?php
/**
* CSV_parser
*
* @package
* @author Dave's Simple Project
* @copyright MESMERiZE
* @version 2012
* @access public
*/
@johndavedecano
johndavedecano / calculator.html
Created July 20, 2012 07:03
Simple JQUERY Calculator
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
$('#1,#2,#3,#4,#5,#6,#7,#8,#9,#0').click(function(){
var v = $(this).val();
@johndavedecano
johndavedecano / upload.cshtml
Created January 31, 2014 01:26
Simple File Upload with File Validation with ASP.net C#
@using System.Collections
@{
if(IsPost)
{
if(Request.Files.Count > 0)
{
string[] allowed = {".jpg",".png",".gif"};
var uploaded = Request.Files[0];
var extension = System.IO.Path.GetExtension(uploaded.FileName);
@johndavedecano
johndavedecano / FlashMessage.cs
Created January 31, 2014 01:31
Simple Flash Message with C#
using System;
using System.Web;
namespace CMSApplication
{
public class FlashMessage : System.Web.UI.Page
{
public void put(string key,string message = "")
{
Session[key] = message;
@johndavedecano
johndavedecano / Pagination.jsx
Created November 3, 2015 14:01
ReactJS SemanticUI Pagination
import React, { Component } from 'react';
class Pagination extends Component {
constructor(props) {
super(props);
this.state = {
currentPage: 1,
items: []
}
this.goTo = this.goTo.bind(this);
@johndavedecano
johndavedecano / lemp.sh
Last active February 23, 2016 02:54
Easily Setup your LEMP Stack for Laravel Development
sudo apt-get install npm
sudo apt-get install git
sudo apt-get install nodejs
sudo apt-get install mysql-server
sudo apt-get install nginx
sudo apt-get install php5-fpm
sudo apt-get install php5-curl php5-mcrypt php5-mysql php5-cli
sudo php5endmod mycrypt
sudo npm install -g gulp
sudo npm install -g bower
@johndavedecano
johndavedecano / block.js
Created February 24, 2016 06:47
Block Special Characters while Typing
function RestrictSpaceSpecial(e) {
var exp = String.fromCharCode(window.event.keyCode)
//Below line will have the special characters that is not allowed you can add if you want more for some characters you need to add escape sequence
var r = new RegExp(/^[a-zA-Z0-9-_]+$/);
if (exp.match(r)) {
return true;
} else {
window.event.keyCode = 0
return false;
}
@johndavedecano
johndavedecano / cors
Created February 27, 2016 14:32 — forked from michaldarda/cors
Just include in your nginx.conf inside location block to enable CORS, I assume that you have more_set_headers plugin compiled
# nginx does not allow add_headers inside if unless its location
set $cors "true";
# Nginx doesn't support nested If statements. This is where things get slightly nasty.
# Determine the HTTP request method used
if ($request_method = 'OPTIONS') {
set $cors "${cors}options";
}
if ($request_method = 'GET') {
@johndavedecano
johndavedecano / app.js
Created March 17, 2016 12:42 — forked from lykmapipo/app.js
Ionic / AngularJS service wrapper for Web SQL API / SQLite-Cordova-Plugin
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@johndavedecano
johndavedecano / EventSystem.js
Created April 17, 2016 14:38 — forked from minwe/EventSystem.js
Global event system for React.js
var EventSystem = (function() {
var self = this;
self.queue = {};
return {
publish: function (event, data) {
var queue = self.queue[event];
if (typeof queue === 'undefined') {