Skip to content

Instantly share code, notes, and snippets.

View fahied's full-sized avatar

Muhammad Fahied fahied

  • Emirates Airlines
  • Dubai
View GitHub Profile
package controllers;
import play.mvc.*;
import com.google.gson.*;
import models.*;
public class Application extends Controller {
@fahied
fahied / Example1.js
Created March 19, 2012 19:04 — forked from tolmasky/Example1.js
On HTML5 Drag and Drop
document.addEventListener("dragstart", function(event)
{
event.dataTransfer.setData("image/png", slides.imageRep());
event.dataTransfer.setData("slides", slides.serializedRep());
// etc.
}, false);
@fahied
fahied / Global.java
Created May 4, 2012 20:05 — forked from joergviola/Global.java
Basic Auth a whole Play 2.0 Application
public class Global extends GlobalSettings {
@Override
public Action onRequest(Request arg0, Method arg1) {
return new Action.Simple() {
public Result call(Context ctx) throws Throwable {
String authConf = Config.getString("basic.auth");
if (authConf == null)
return delegate.call(ctx);
String auth = ctx.request().getHeader("Authorization");
@interface NSManagedObject (Serialization)
- (NSDictionary*) toDictionary;
- (void) populateFromDictionary:(NSDictionary*)dict;
+ (NSManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict
inContext:(NSManagedObjectContext*)context;
@end
@fahied
fahied / gist:b1389a04a0207448aa50
Last active August 29, 2015 14:01
installing pod : permission denied
sudo chown -R `whoami` path/to/project/
if that doesn't help, you can also try
sudo chown -R `whoami` ~/.cocoapods
sudo chown -R `whoami` ~/Library/Caches/CocoaPods
# Copyright: Benjamin Weiss (keyboardsurfer) https://github.com/keyboardsurfer
# Under CC-BY-SA V3.0 (https://creativecommons.org/licenses/by-sa/3.0/legalcode)
# built application files
*.apk
*.ap_
*.jar
!gradle/wrapper/gradle-wrapper.jar
# lint folder
@fahied
fahied / play2
Created June 26, 2014 09:05
Play framework 2.x.x Best Practices
########### Useful Commands ###########
# Download source code for Java API used in project
$ play "eclipse with-source=true"
# Run Play in https mode
$ JAVA_OPTS=-Dhttps.port=9001 play start
########### Useful Liberaries ###########
# Mongodb Wrapper for JAVA
http://jongo.org/
@fahied
fahied / aps-node
Last active October 6, 2015 10:11
Preparing APS Certificates for node-apn
After requesting the certificate from Apple, export your private key as a .p12 file and
download the .cer file (usually named aps_production.cer or aps_development.cer) from
the iOS Provisioning Portal.
Now, in the directory containing cert.cer and key.p12 execute the following commands to
generate your .pem files:
openssl x509 -in aps_development.cer -inform DER -outform PEM -out aps_development.pem
@fahied
fahied / gitcheat
Last active August 29, 2015 14:03
GIT Cheatsheet
# Change the current branch to master in git #
You can rename/remove master on remote, but this will be an issue if lots of people have based their work on the remote master branch and have pulled that branch in their local repo.
That might not be the case here since everyone seems to be working on branch 'seotweaks'.
In that case you can:
(Make a git remote --show to check how your remote is declared within your local repo. I will assume 'origin')
(Regarding GitHub, house9 comments: "I had to do one additional step, click the 'Admin' button on GitHub and set the 'Default Branch' to something other than 'master', then put it back afterwards")
@fahied
fahied / jquery-uiwebview
Created August 26, 2014 09:55
jquery hash or query in UIWebview
// set path for the file to load in uiwebview
NSString *filePath = [resourceDir stringByAppendingPathComponent:@"index.html"];
// convert to NSURL object, remember not to incoude #tag yet, as fileURLWithPath will replacce jquery # with %23
// and will cause trouble to load your page properly
NSURL *fileURL = [NSURL fileURLWithPath:menuPath];
// add hash here
fileURL = [NSURL URLWithString:@"#menu" relativeToURL:fileURL];