Skip to content

Instantly share code, notes, and snippets.

View msalahz's full-sized avatar
🎯
Focusing

Mohammed Zaghloul msalahz

🎯
Focusing
View GitHub Profile
@msalahz
msalahz / GitHub-Desktop-Bitbucket.md
Created March 21, 2018 06:20 — forked from glueckpress/GitHub-Desktop-Bitbucket.md
[How-to] Use GitHub Desktop to clone and commit to a Bitbucket repository just as you would with any GitHub repository. (Mac)

Clone Bitbucket Repository and Add it to GitHub Desktop App (Mac)

You can’t clone a Bitbucket repo using GithHub Desktop directly. Instead you would have to:

  1. Clone the Bitbucket repo locally via command line.
  2. Add the cloned repository to your GitHub Desktop app.

After completing these 2 steps, you’ll be able to execute sync, push, pull, commit, and other git commands available in GitHub Desktop for your Bitbucket repository just as you would for any GitHub repository.

You will need your Bitbucket repository’s git URL as available on the Overview page of your repository:

@msalahz
msalahz / .eslintrc
Last active March 9, 2018 04:34
eslint
module.exports = {
'extends': [
'airbnb',
'prettier',
'prettier/react'
],
"parser": "babel-eslint",
'parserOptions': {
'ecmaVersion': 8,
'ecmaFeatures': {
var arr = ["a", "b", "c"];
var obj = {};
/* Method no: 1 */
arr.forEach(function(item, index) {
obj[index] = item;
});
import Ember from 'ember';
const countries = Ember.A(["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua & Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas",
"Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia & Herzegovina","Botswana","Brazil","British Virgin Islands",
"Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Cape Verde","Cayman Islands","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica",
"Cote D Ivoire","Croatia","Cruise Ship","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea",
"Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana",
"Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bissau","Guyana",
@msalahz
msalahz / squirt.js
Created January 14, 2018 00:32 — forked from joelpt/squirt.js
Manually calculate the square root of a number with Javascript
// The Babylonian Method
// http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
// @param n - the number to compute the square root of
// @param g - the best guess so far (can omit from initial call)
function squirt(n, g) {
if (!g) {
// Take an initial guess at the square root
g = n / 2.0;
}
var d = n / g; // Divide our guess into the number
@msalahz
msalahz / postgres_table_row_count.sql
Created December 24, 2017 21:53
Row counts for all tables in a postgres db.
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
@msalahz
msalahz / .gitlab-ci.yml
Created October 26, 2017 08:40 — forked from mupkoo/.gitlab-ci.yml
Using Ember-CLI with Chrome on GitLab CI
image: node:7.10
cache:
paths:
- node_modules/
- bower_components/
before_script:
# Install Chrome
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
@msalahz
msalahz / controllers.application.js
Last active October 26, 2017 13:43 — forked from poteto/controllers.application.js
ember-changeset-validations demo
import Ember from 'ember';
import AdultValidations from '../validations/adult';
import ChildValidations from '../validations/child';
import { reservedEmails } from '../validators/uniqueness';
import { schema } from '../models/user';
const { get } = Ember;
const { keys } = Object;
export default Ember.Controller.extend({
@msalahz
msalahz / Local SSL websites on macOS Sierra.md
Last active August 2, 2017 10:55 — forked from jonathantneal/README.md
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
import Ember from 'ember';
import hbs from "htmlbars-inline-precompile";
import Redux from 'redux';
const { createStore } = Redux;
const reducer = (state, action) => { console.log(state, action);
if(action.type === 'ADD'){
return Object.assign({}, state, {number: state.number + 1});
}