Skip to content

Instantly share code, notes, and snippets.

View Galilyou's full-sized avatar
🎯
Focusing

Ahmed Elhalwagy Galilyou

🎯
Focusing
View GitHub Profile
DecisionService.prototype.getVariation = function(configObj, experimentKey, userId, attributes) {
// by default, the bucketing ID should be the user ID
var bucketingId = this._getBucketingId(userId, attributes);
if (!this.__checkIfExperimentIsActive(configObj, experimentKey, userId)) {
return null;
}
var experiment = configObj.experimentKeyMap[experimentKey];
var forcedVariationKey = this.getForcedVariation(configObj, experimentKey, userId);
if (!!forcedVariationKey) {
@Galilyou
Galilyou / book-reviewes.js
Created July 2, 2019 21:02
display an li with book reviews
jQuery.getJSON('http://67.215.227.107/cgi-bin/koha/svc/report?id=19', (data) => {
const ul = document.createElement('ul');
data.forEach((value) => {
const li = document.createElement('li');
const img = `<div><img src="${value[0]}" alt="" /></div>`;
const title = `<div>${value[1]}<div>`;
const approved = `<div><p>${value[2]}</p></div>`;
const review = `<div><p>${value[3]}</p></div>`;
li.innerHTML = img + title + approved + review;
@Galilyou
Galilyou / vscode-settings.json
Last active October 25, 2019 22:12
vscode-settings
{
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "Material Theme Ocean",
"editor.tabSize": 2,
"editor.fontSize": 15,
"editor.fontLigatures": true,
"gitlens.advanced.messages": {
"suppressCommitHasNoPreviousCommitWarning": false,
"suppressCommitNotFoundWarning": false,
"suppressFileNotUnderSourceControlWarning": false,
{
"sessions-161004": {
"aliases": {},
"mappings": {
"session": {
"properties": {
"a1": {
"type": "long"
},
"a2": {
[TestFixture]
public class StringExtensionTests
{
[TestCase(null, "old", "new", Result = null)]
[TestCase("", "old", "new", Result = "")]
public string ReplaceCalledOnNullOrEmptyReturnsNullOrEmpty(string src, string oldValue, string newValue)
{
var result = src.Replace(oldValue, newValue, StringComparison.OrdinalIgnoreCase);
return result;
/* Problem specs
* The prime factors of 13195 are 5, 7, 13 and 29.
* What is the largest prime factor of the number 600851475143 ?
*/
(function(largestPrime) {
/*
* checks whether the passed in number is prime
* fails if the passed in number is a string, I believe