Skip to content

Instantly share code, notes, and snippets.

View infacq's full-sized avatar

Muhaimin infacq

  • Seri Kembangan, Selangor Malaysia
View GitHub Profile
@infacq
infacq / config.json
Last active August 29, 2015 14:14 — forked from anonymous/config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#41cac0, 6.5%)",
"@brand-success": "rgb(28, 184, 65)",
@infacq
infacq / example-usage.js
Last active August 29, 2015 14:05 — forked from nedga055/example-usage.js
plupload example usage with requirejs
// Add this to the onRender() of the view you want to add your file upload to
// The options passed in will override the default Plupload options
// (http://www.plupload.com/documentation.php)
this.fileUploadView = new FileUploadView({
el: '#upload-container',
url: 'upload.php',
successMessage: 'Your file uploaded successfully.'
});
this.fileUploadView.render();
define(function(require) {
'use strict';
var _ = require('underscore')
return {
handleAjaxSuccess: function() {
if (_.isFunction(this.closeForm)) {
this.closeForm()
}
<?php
/**
* On-the-fly CSS Compression
* Copyright (c) 2009 and onwards, Manas Tungare.
* Creative Commons Attribution, Share-Alike.
*
* In order to minimize the number and size of HTTP requests for CSS content,
* this script combines multiple CSS files into a single file and compresses
* it on-the-fly.
*
@infacq
infacq / view.js
Created January 20, 2014 04:53
One way to avoid it, is to collect all rendered elements into one documentFragment, which is basically just a container for DOM elements, and then appending that single container to the DOM tree - triggering only a single page reflow. http://ozkatz.github.io/avoiding-common-backbonejs-pitfalls.html
render: function() {
this.$el.empty();
var container = document.createDocumentFragment();
// render each subview, appending to our root element
_.each(this._views, function(subview) {
container.appendChild(subview.render().el)
});
this.$el.append(container);
}
login: function (event) {
event.preventDefault(); // Don't let this button submit the form
$('.alert').remove(); // Hide any errors on a new submit
var url = './service/login';
$('.btn-login').button('loading');
var formValues = {
email: $('#tEmail').val(),
pwd: $('#tPwd').val()
};
/**
* Quick and dirty login function with hard coded credentials (admin/admin)
* This is just an example. Do not use this in a production environment
*/
function login() {
if(!empty($_POST['email']) && !empty($_POST['password'])) {
// normally you would load credentials from a database.
// This is just an example and is certainly not secure
if($_POST['email'] == 'admin' && $_POST['password'] == 'admin') {
$user = array("email"=>"admin", "firstName"=>"Web", "lastName"=>"Scents", "token"=>base64_encode(openssl_random_pseudo_bytes(16)));
@infacq
infacq / form.php
Created January 13, 2014 04:01 — forked from mikaelz/form.php
<?php
require dirname(__FILE__) . '/functions.php';
$module = md5('MODULE_NAME');
$page_url = sanitize($_SERVER['PHP_SELF']);
if (isset($_POST['firstname']))
require dirname(__FILE__) . '/save.php';
@infacq
infacq / tablePagination.js
Last active December 28, 2015 23:09
Keperluan * Twitter Bootstrap 3 * jQuery 1.6++ * Pemproses disebelah server (PHP, Go, Python)
!function ($) {
$(function() {
var mSurat = function(hlmSemasa, perLaman, JumlahRekod, skopDom, callback) {
var RkdSudahTersiar = hlmSemasa * perLaman,
lamanTerakhir = Math.ceil(JumlahRekod / perLaman),
JumRkdSudahTersiar;
if(RkdSudahTersiar > JumlahRekod)
JumRkdSudahTersiar = JumlahRekod;
else