Skip to content

Instantly share code, notes, and snippets.

View NouranMahmoud's full-sized avatar
✈️
New Life Challenges! - تحديات جديدة

Nouranology NouranMahmoud

✈️
New Life Challenges! - تحديات جديدة
View GitHub Profile
[percy:config] Found config file: .percy.json (0ms)
[percy:config] Using config:
{
version: 2,
snapshot: {
widths: [
375,
1280,
1920
import Ember from 'ember';
export default Ember.Component.extend({
});
@NouranMahmoud
NouranMahmoud / Great Common Factor(divisor).js
Last active March 31, 2020 04:30
Two ways with Two functions to calculate the GCF for (two numbers) only.
/*
Greatest Common Factor
GCF function takes two numbers and generates the greatest common factor.
*/
function GCF(num1, num2) {
var arr1 = findFactors(num1);
var arr2 = findFactors(num2);
@NouranMahmoud
NouranMahmoud / Least Common Multiple.js
Last active December 30, 2018 10:17
Least Common Multiple (LCM)
// Least Common Multiple
function LCM(n, m, range) {
var list1 = [];
var list2 = [];
var match;
for(var i = 1; i <= range; i++) {
list1.push(n*i)
@NouranMahmoud
NouranMahmoud / Branching singleton pattern
Created June 17, 2015 16:29
Branching is a technique that allows you to encapsulate browser differences into dynamic methods that get set at run-time. Once the initialization is complete, each browser only executes the code specific to its implementation of Javascript.
/* SimpleXhrFactory signleton, step2 */
var SimpleXhrFactory = (function(){
//The three branches.
var standard = {
createXhrObject: function(){
return new XMLHttpRequest();
}
};
var activeXNew = {
createXhrObject: function(){
requirejs = require('./node_modules/requirejs/bin/r.js')
baseConfig =
baseUrl: "./war/scripts/app"
locale: "en-us"
optimize: "uglify"
preserveLicenseComments: false
name: "almond"
findNestedDependencies: true
wrap: true
paths:
module.exports = function(grunt) {
grunt.initConfig({
jade: {
compile: {
options: {
client: false,
pretty: true
},
files: [ {
expand: true,
/**
* GoogleMapsAPI Loader Module
*
* Returns a promise that resolves with the google.maps object when all of the google maps api loading process is complete
*
* Example Usage:
*
* define([ 'app/lib/google-maps-loader' ], function(GoogleMapsLoader){
* GoogleMapsLoader.done(function(GoogleMaps){
* // your google maps code here!
it 'should reject the promise when there are no passed options ', (done)->
user = new ObjectRef '/users/123/'
result = user.get()
expect(result.isRejected()).toBeTruthy()
result.then null, (err) ->
console.log err
expect(err).toThrow new ReallyError 'Can\'t be called without passing arguments'
done()
// In controller
@map_markers = []
@estates.each do |key,value|
marker = {location: key.location, estates: value.collect(&:id),property: key.name}
@map_markers << marker
end
// In the view
<%= hidden_field_tag :coordiates,"",id: "coordinates", data: { markers: @map_markers, boundaries: @location } %>