Skip to content

Instantly share code, notes, and snippets.

✔️
Available

Mohamed Mansour mohamedmansour

✔️
Available
Block or report user

Report or block mohamedmansour

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 keybase.md

Keybase proof

I hereby claim:

  • I am mohamedmansour on github.
  • I am mohamedmansour (https://keybase.io/mohamedmansour) on keybase.
  • I have a public key ASDXVqA3srRPgG6gYwdTRJjC-OxoALXBRroXqf-r4bO2nAo

To claim this, I am signing this object:

@mohamedmansour
mohamedmansour / launch.json
Created Oct 24, 2018
webpack-dev-server integration with vscode and typescript for react
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Debug",
View crawler.js
const cheerio = require('cheerio')
const request = require('request')
const { URL } = require('url')
const async = require('async')
var links = {}
fetchAllLinks('https://crawl.codeferret.net/1.html', links, () => {
let listLinks = Object.keys(links).map(link => {return `"${link}"`})
console.log(`[\n ${listLinks.join(',\n ')}\n ]`)
})
@mohamedmansour
mohamedmansour / alexa-node.js
Created Feb 18, 2017
Hackathon - Amazon Alexa Backend using Lambda
View alexa-node.js
var http = require('http');
exports.handler = function (event, context) {
try {
console.log("event.session.application.applicationId=" + event.session.application.applicationId);
if (event.session.new) {
onSessionStarted({requestId: event.request.requestId}, event.session);
View BundlerHtmlHelper.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Html;
using Newtonsoft.Json;
namespace HtmlHelpers
{
/// <summary>
View gist:6c8d4e342f9c791d8d55
task<GeolocationAccessStatus> geolocationAccessRequestTask(Windows::Devices::Geolocation::Geolocator::RequestAccessAsync());
geolocationAccessRequestTask.then([this](task<GeolocationAccessStatus> accessStatusTask)
{
// Get will throw an exception if the task was canceled or failed with an error
auto accessStatus = accessStatusTask.get();
if (accessStatus == GeolocationAccessStatus::Allowed)
{
// LOG: Waiting for update...
auto geolocator = ref new Windows::Devices::Geolocation::Geolocator();
View gist:33802d10fcf218e28fc6
// In jQuery the easy thing to do when to decruft json responses if a javascript has:
//
// for (;;); {foo: 'bar'}
//
// Is to decruft it using ajax converters. Example
$.ajaxSetup({
converters: {
"text json": function(result) {
return JSON.parse(result.replace('for (;;);', ''));
@mohamedmansour
mohamedmansour / Animation.xaml
Created Jul 3, 2014
Pulse Animation in XAML
View Animation.xaml
<UserControl.Resources>
<Storyboard x:Name="StartAnimation">
<DoubleAnimation RepeatBehavior="Forever" Duration="0:0:1" To="360" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="ProgressArc"/>
<DoubleAnimation Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True" From="25" To="35" Storyboard.TargetName="IndicatorRing" Storyboard.TargetProperty="StrokeThickness"/>
<DoubleAnimation Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True" From="350" To="370" Storyboard.TargetName="IndicatorRing" Storyboard.TargetProperty="Height"/>
<DoubleAnimation Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True" From="350" To="370" Storyboard.TargetName="IndicatorRing" Storyboard.TargetProperty="Width"/>
</Storyboard>
</UserControl.Resources>
@mohamedmansour
mohamedmansour / gist:dc0c56820015e7f700e9
Last active Aug 29, 2015
Basic Cross Sandbox Communication for iOS 8 Action Extensions
View gist:dc0c56820015e7f700e9
// Append the transfer dom to the document.
var transferDOM = document.createElement('div');
transferDOM.style.display = 'none';
transferDOM.id = 'transferdom';
document.body.appendChild(transferDOM);
function injectScript(fn) {
var script = document.createElement('script');
script.appendChild(document.createTextNode('(' + fn + ')();'));
document.body.appendChild(script);
@mohamedmansour
mohamedmansour / Popup.xaml
Created May 10, 2014
Example of a popup control in Xaml with nice triangle
View Popup.xaml
<Grid x:Name="LayoutRoot" Background="Transparent" Margin="0,55,0,0">
<Grid Background="White" Margin="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="20" Background="Transparent">
<TextBlock Text="Listening" FontSize="36" Margin="0"/>
</StackPanel>
<StackPanel Grid.Row="1" Margin="20" Background="Transparent" VerticalAlignment="Bottom">
You can’t perform that action at this time.