Skip to content

Instantly share code, notes, and snippets.

Daniel Chikaka danielchikaka

Block or report user

Report or block danielchikaka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danielchikaka
danielchikaka / app.js
Created Aug 28, 2018 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
View app.js
'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');
View example.js
var defaults = {
number: 1,
bool: true,
magic: 'real',
animal: 'whale',
croutons: 'delicious'
};
var options = {
number: 2,
View jsbin.gewozekoxi.js
function todayDate(){
var day;
switch(new Date().getDay()){
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
@danielchikaka
danielchikaka / global-variables-are-bad.js
Created Aug 2, 2017 — forked from hallettj/global-variables-are-bad.js
How and why to avoid global variables in JavaScript
View global-variables-are-bad.js
// 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() {
View laravel-query-many-to-many-relationship.md

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 Jun 7, 2016 — forked from kbond/post.md
Ubuntu LAMP Development Environment Setup
View post.md

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 Mar 8, 2016 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type
View 01_Laravel 5 Simple ACL manager_Readme.md

#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

View Javascript Money format
function toCurrency(price) {
return price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
@danielchikaka
danielchikaka / angular-remove-white-space-filter.js
Last active Aug 29, 2015 — forked from builtbylane/angular-remove-white-space-filter.js
AngularJS – filter: removes white space from text. useful for html values that cannot have spaces
View angular-remove-white-space-filter.js
/**
* 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, '');
View function.js
Function.prototype.compose = function(argFunction) {
var invokingFunction = this;
return function() {
return invokingFunction.call(this, argFunction.apply(this,arguments));
}
}
You can’t perform that action at this time.