Skip to content

Instantly share code, notes, and snippets.

View danielchikaka's full-sized avatar

Daniel Chikaka danielchikaka

View GitHub Profile
@danielchikaka
danielchikaka / app.js
Created August 28, 2018 15:16 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
var defaults = {
number: 1,
bool: true,
magic: 'real',
animal: 'whale',
croutons: 'delicious'
};
var options = {
number: 2,
@danielchikaka
danielchikaka / global-variables-are-bad.js
Created August 2, 2017 05:18 — forked from hallettj/global-variables-are-bad.js
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
@danielchikaka
danielchikaka / laravel-query-many-to-many-relationship.md
Created June 15, 2017 07:44 — forked from aquasmit/laravel-query-many-to-many-relationship.md
Laravel - Eloquent - query many to many relationship

Laravel - Eloquent - query many to many relationship

Example:

Table 1: posts

Table 2: categories

Pivot Table: category_post with foreign keys category_id, post_id

@danielchikaka
danielchikaka / post.md
Created June 7, 2016 08:39 — forked from kbond/post.md
Ubuntu LAMP Development Environment Setup

Install git:

sudo apt-get install git

Configure Git:

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
git config --global user.name "Your Name"

git config --global user.email "Your Email"

@danielchikaka
danielchikaka / 01_Laravel 5 Simple ACL manager_Readme.md
Created March 8, 2016 07:01 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@danielchikaka
danielchikaka / angular-remove-white-space-filter.js
Last active August 29, 2015 14:25 — forked from builtbylane/angular-remove-white-space-filter.js
AngularJS – filter: removes white space from text. useful for html values that cannot have spaces
/**
* Description:
* removes white space from text. useful for html values that cannot have spaces
* Usage:
* {{some_text | nospace}}
*/
app.filter('nospace', function () {
return function (value) {
return (!value) ? '' : value.replace(/ /g, '');
Function.prototype.compose = function(argFunction) {
var invokingFunction = this;
return function() {
return invokingFunction.call(this, argFunction.apply(this,arguments));
}
}
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
=======[ Media Queries - default media query break points ]=======
@media(max-width:767px) {
}
@media(min-width:768px) {
}
@media(min-width:992px) {