Skip to content

Instantly share code, notes, and snippets.

View Eazybright's full-sized avatar
🏠
Working from home

Kolawole Ezekiel Eazybright

🏠
Working from home
View GitHub Profile
<?php
namespace App\Http\Middleware;
use Closure;
use App\Reward;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
class RewardMiddleware
@AbdullahMagat
AbdullahMagat / Hackerrank Java Anagrams Solution
Created July 26, 2018 19:19
Hackerrank Java Anagrams Solution
import java.util.Scanner;
public class Solution {
static boolean isAnagram(String a, String b) {
// // once you declare a.toUppercase you should assign it to a. you cannot define it as just a.toUppercase...
// //I solved it with the long way however I could put a and b in a character array and then use Arrays.sort(arrayname). after this steps convert them to string and check if they are equel.
a=a.toUpperCase();
b=b.toUpperCase();
boolean ret = false;
StringBuilder c= new StringBuilder(b);
@Eazybright
Eazybright / eloquentJavaScript.js
Created February 19, 2018 19:09 — forked from alexhawkins/eloquentJavaScript.js
Solutions for Eloquent Javascript Chapter 3, 4 Exercises (Functions, Arrays, Objects)
'use strict';
/****************************************
* Chapter 3 Exercises: Functions
*****************************************
#EXERCISE 1: Minimum
The previous chapter introduced the standard function Math.min that returns
its smallest argument. We can do that ourselves now. Write a function min that
@Eazybright
Eazybright / gist:e9386f28af28d6ca69118d1c9e44bb18
Created February 19, 2018 16:03 — forked from nlapier/gist:eb394fe78ed28a25b1ed
Running solutions for Eloquent Javascript - comments are welcome!
/****************************
Chapter 4: Reversing an Array
*****************************
Arrays have a method reverse, which changes the array by inverting the order in which its elements appear.
For this exercise, write two functions, reverseArray and reverseArrayInPlace.
The first, reverseArray, takes an array as argument and produces a new array that has the same elements in the inverse order.
The second, reverseArrayInPlace, does what the reverse method does:
it modifies the array given as argument in order to reverse its elements. Neither may use the standard reverse method.
*/
@Eazybright
Eazybright / EloquentJS_SE0201.js
Created February 15, 2018 03:32 — forked from ivanteoh/EloquentJS_SE0201.js
My answer for exercise in Eloquent JavaScript Second Edition
/*
My answer for exercise 'Looping a triangle'
in Eloquent JavaScript Second Edition
Chapter 2 Program Structure
*/
var note = '';
for (var i = 0; i < 7; i++) {
console.log(note += '#');
}
@jarhoads
jarhoads / isogram.js
Last active June 5, 2018 01:26
Some ideas on checking for an isogram in javascript
var Isogram = function(w){
var word = w.toLowerCase().split('');
this.isIsogram = function(){
var letters = new Object(null);
for(var i = 0; i < word.length; i++){
@mrabbani
mrabbani / mailgun-config.md
Last active January 8, 2024 01:45
Laravel Mailgun Setup
@ivanteoh
ivanteoh / EloquentJS_SE0201.js
Last active May 26, 2019 19:38
My answer for exercise in Eloquent JavaScript Second Edition
/*
My answer for exercise 'Looping a triangle'
in Eloquent JavaScript Second Edition
Chapter 2 Program Structure
*/
var note = '';
for (var i = 0; i < 7; i++) {
console.log(note += '#');
}
@umidjons
umidjons / sort-object-properties-by-value.md
Last active January 16, 2024 13:00
JavaScript: sort object properties by value (numeric or string)

Sort object properties by value (values are text)

I have following object:

var cities={10:'Tashkent', 14:'Karakalpakiya', 16:'Andijan'};

I want sort it by city names, so after sort it should be:

var cities={16:'Andijan', 14:'Karakalpakiya', 10:'Tashkent'};

But I can't sort object properties, instead can convert object into array, then sort items.

@johnhunter
johnhunter / gist:1362075
Created November 13, 2011 12:46
Example JavaScript Pseudo-class
// Example Pseudo-class
var Animal = (function() {
function Animal(name) {
this.name = name;
}
Animal.prototype.getName = function () {
return this.name;
};