Skip to content

Instantly share code, notes, and snippets.

@resting
resting / nativeJavaScript.js
Created May 28, 2018 16:05 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
<?php
///////////////////////////////////////////////////
// STEP 1 - CREATE CLASS THAT WILL BE USED GLOBALY
///////////////////////////////////////////////////
namespace App\MyApp;
class MyApp {
public function sayHello($data = [])
{
echo "Hello World from Facade!";
}
@resting
resting / restrict-decimal-places.directive.ts
Last active December 20, 2017 08:18
Restrict decimal places Angular
// inspired by https://stackoverflow.com/questions/41465542/angular2-input-field-to-accept-only-numbers
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
@Directive({
selector: '[restrictDecimalPlaces]'
})
export class RestrictDecimalPlacesDirective {
constructor(private el: ElementRef) {
}
@resting
resting / only-numbers.directive.ts
Created December 20, 2017 03:18
only-numbers.directive.ts
// https://stackoverflow.com/questions/41465542/angular2-input-field-to-accept-only-numbers
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
@Directive({
selector: '[OnlyNumber]'
})
export class OnlyNumberDirective {
constructor(private el: ElementRef) {
}
@resting
resting / devise-manual-methods.rb
Created August 21, 2017 13:05
Devise manual methods
# Devise manual methods
# Sign up
# 1. Check if existing user exists
User.find_by_email(params[:email])
# 2. Create the user
u = User.new(permit_params)
u.password_confirmation = params[:password]
u.save!
@resting
resting / dynamic-react-component.js
Created August 16, 2017 03:14
dynamic-react-component
const SubCatItem = (props) => {
return (
<div className="col-md-4">
{props.ele}
</div>
)
}
const SubCatRow = (props) => {
return (
@resting
resting / gist:46f402acb13344478b653c8722a8be33
Created August 7, 2017 03:46 — forked from siromega/gist:1348779
Fixing FOUC with jQueryMobile
<!DOCTYPE html>
<html class="no-js">
<head>
<!-- stuff -->
<!-- FOUC fix -->
<style type="text/css">
.no-js {display: none;}
</style>
</head>
@resting
resting / Laravel PHP7 LEMP AWS.md
Created July 11, 2017 19:32 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@resting
resting / default
Created July 11, 2017 18:32
Nginx sites-available/default
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
@resting
resting / .eslintrc
Created July 10, 2017 02:11
.eslintrc
{
"extends": "airbnb",
"rules": {
"func-names": ["error", "never"]
}
}