Skip to content

Instantly share code, notes, and snippets.

✈️
New Life Challenges! - تحديات جديدة

Nouranology NouranMahmoud

✈️
New Life Challenges! - تحديات جديدة
Block or report user

Report or block NouranMahmoud

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
View components.my-post.js
import Ember from 'ember';
export default Ember.Component.extend({
});
@NouranMahmoud
NouranMahmoud / Least Common Multiple.js
Last active Dec 30, 2018
Least Common Multiple (LCM)
View Least Common Multiple.js
// 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 / Great Common Factor(divisor).js
Last active Dec 30, 2018
Two ways with Two functions to calculate the GCF for (two numbers) only.
View Great Common Factor(divisor).js
/*
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 / Branching singleton pattern
Created Jun 17, 2015
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.
View Branching singleton pattern
/* SimpleXhrFactory signleton, step2 */
var SimpleXhrFactory = (function(){
//The three branches.
var standard = {
createXhrObject: function(){
return new XMLHttpRequest();
}
};
var activeXNew = {
createXhrObject: function(){
View build.coffee
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:
View Gruntfile
module.exports = function(grunt) {
grunt.initConfig({
jade: {
compile: {
options: {
client: false,
pretty: true
},
files: [ {
expand: true,
View google-maps-loader.js
/**
* 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!
View gist:e4362d27a566734f938e
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()
View gist:e753c85f2320206e94f4
// 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 } %>
View git workflow
git remote add upstream THE_SOURCE_REPO
git remote add YOUR_USER_NAME YOUR_FORK
git remote set-url origin THE_SOURCE_REPO
git remote set-url origin --push YOUR_FORK
git config --global push.default current
You can’t perform that action at this time.