Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mohamnag on github.
  • I am mohamnag (https://keybase.io/mohamnag) on keybase.
  • I have a public key ASD99SsajQkw3NOzAMzFtK_U1qvHT8MAQYLJUoVs0Ynhlwo

To claim this, I am signing this object:

@mohamnag
mohamnag / README.md
Last active May 25, 2017 10:08
Kotlin+JSF SPA Framework: Call for comments

Kotlin + JSF in browser as SPA

Now that Google is officially setting Kotlin as Anroid's language and knowing that Kotlin can be cross-compiled to both Java and JavaScript, I came to the idea to build up a Kotlin based framework for making Single Page Applications for web. Idea is to reuse as much code as possible. Pretty much like what GWT and many many similar frameworks have tried to achieve too.

As for templating language, there are a lot of options out there, but if we are talking about winning over the Java community, then why not JSF? It is well-known in Java EE community and could take us one more step toward resuability of the code as it can be used by any JEE container supporting JSF. Considering the fact that Kotlin could also be used in JEE containers!

@mohamnag
mohamnag / WebEngineLoadBug.java
Last active March 9, 2016 13:26 — forked from bugabinga/WebEngineLoadBug.java
Attempt to reproduce a WebEngine loading bug in JavaFX (failed)
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import netscape.javascript.JSObject;
/**
abstract class Tree
case class Sum(l: Tree, r: Tree) extends Tree {
override def toString(): String = "(" + l + " + " + r + ")"
}
case class Var(n: String) extends Tree {
override def toString(): String = n
}
@mohamnag
mohamnag / run.sh
Created March 17, 2015 10:12
swap file on aws micro instances
sudo dd if=/dev/zero of=/var/swapfile bs=1M count=2048
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
echo /var/swapfile none swap defaults 0 0 | sudo tee -a /etc/fstab
sudo swapon -a
@mohamnag
mohamnag / gist:4564144427df886593ed
Created February 26, 2015 09:26
s3cmd sync necessary user policy, this policy should be attached to user in IAM console
{
"Statement": [
{
"Action": [
"s3:ListAllMyBuckets"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
@mohamnag
mohamnag / mixin.scss
Last active August 29, 2015 14:13
Adds a shadowy border on top of the element using the :before pseudo element, you may apply the last three lines directly to the element itself if you dont need additional background on the same element.
@mixin shadow-border-top($size: 10px) {
&:before {
content: "";
width: 100%;
height: $size;
display: block;
top: 0;
position: absolute;
background: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0.09) 75%, white 88%, white 100%) no-repeat;
background-position: 0 -$size / 2;
@mohamnag
mohamnag / .bash_profile
Created December 31, 2014 18:24
My preferred bash prompt
export PS1="\\[$(tput setaf 6)\\]\\u:\\w #\\[$(tput sgr0)\\] "
@mohamnag
mohamnag / mixins.scss
Created December 16, 2014 11:51
CSS3 show and hide animation
$veryBigWidth: 100rem;
$veryBigHeight: 100rem;
@mixin transition-hide {
transition: opacity 0.5s ease;
visibility: hidden;
opacity: 0;
max-height: 0;
max-width: 0;
@mohamnag
mohamnag / mixins.scss
Created November 27, 2014 13:12
using a font for icons
/*
This adds the desired character as an overlayed icon vertically and horizontally
centered on the element.
This uses the :after pseudo element so this element is not usable afterwards.
*/
@mixin fontIcon($font, $char, $size) {
&:after {
// character related to the desired icon
content: $char;