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
@Eazybright
Eazybright / sort-object-properties-by-value.md
Created November 13, 2019 06:28 — forked from umidjons/sort-object-properties-by-value.md
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.

@Eazybright
Eazybright / gist:bbd7aa0941f926f86953dc60657a09ed
Created September 17, 2019 07:22 — forked from johnhunter/gist:1362075
Example JavaScript Pseudo-class
// Example Pseudo-class
var Animal = (function() {
function Animal(name) {
this.name = name;
}
Animal.prototype.getName = function () {
return this.name;
};
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 / mailgun-config.md
Created October 15, 2018 00:19 — forked from mrabbani/mailgun-config.md
Laravel Mailgun Setup
@Eazybright
Eazybright / isogram.js
Created June 5, 2018 01:26 — forked from jarhoads/isogram.js
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++){
@Eazybright
Eazybright / email.php
Created February 28, 2018 14:49 — forked from waifung0207/email.php
CodeIgniter email config file (Gmail)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| EMAIL CONFING
| -------------------------------------------------------------------
| Configuration of outgoing mail server.
| */
$config['protocol'] = 'smtp';
@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 += '#');
}
<?php
//check for referal links
function referal()
{
$CI =& get_instance();
$cookie_value_set = $CI->input->cookie('_tm_ref', TRUE) ? $CI->input->cookie('_tm_ref', TRUE) : '';
if ($CI->input->get('ref', TRUE) AND $cookie_value_set == '') {
// referred user so set cookie to ref=username
$cookie = array(
'name' => 'ref',