Skip to content

Instantly share code, notes, and snippets.

@abedsujan
abedsujan / angularjs-client-side-caching.js
Last active April 16, 2016 10:58
angularjs-client-side-caching
myapp.factory("movies", function($q, $http){
var cacheMovies, p;
return {
getMovies: function(){
return $q.when(cacheMovies || p || helper());
}
}
function helper(){
var deffered = $q.defer();
p = deffered.promise;
@abedsujan
abedsujan / jquery_signup_password_match.js
Last active April 1, 2016 22:01
jquery signup form passoword match functionality
//Problem: Hints are shown even when form is valid
//Solution: Hide and show them at appropriate times
var $password = $("#password");
var $confirmPassword = $("#confirm_password");
//Hide hints
$("form span").hide();
function isPasswordValid() {
return $password.val().length > 8;
@abedsujan
abedsujan / jquery_responsive_mobile_menu._index.html
Created April 1, 2016 21:01
Simple jQuery responsive menu.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div id="menu">
<ul>
<li class="selected"><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
@abedsujan
abedsujan / jquery_modal.js
Last active April 1, 2016 11:46
Jquery Modal or lightbox example
//Problem: User when clicking on image goes to a dead end
//Solution: Create an overlay with the large image - Lightbox
var $overlay = $('<div id="overlay"></div>');
var $image = $("<img>");
var $caption = $("<p></p>");
//An image to overlay
$overlay.append($image);
@abedsujan
abedsujan / PHP Date diff
Last active February 28, 2016 12:10
PHP get age year from birthdate
<?php
function birthday($birthday){
$age = strtotime($birthday);
if($age === false){
return false;
}
list($y1,$m1,$d1) = explode("-",date("Y-m-d",$age));
<input data-datepicker-force="0" data-datepicker-settings="date" data-datepicker-months="Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember" data-datepicker-day
<?php
namespace Sfi\Migration\Command;
/* *
* This script belongs to the TYPO3 Flow package "Sfi.Migration". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Cli\CommandController;
@abedsujan
abedsujan / boiler
Created August 10, 2015 23:06
Javascript boilerplate
(function () {
'use strict';
}());

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@abedsujan
abedsujan / Demo Link
Last active December 11, 2015 17:18
MySQL – left join on last (or first) record in the right table