Skip to content

Instantly share code, notes, and snippets.

Muhammad Fahied fahied

Block or report user

Report or block fahied

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 Application.java
package controllers;
import play.mvc.*;
import com.google.gson.*;
import models.*;
public class Application extends Controller {
@fahied
fahied / Example1.js
Created Mar 19, 2012 — forked from tolmasky/Example1.js
On HTML5 Drag and Drop
View Example1.js
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 — forked from joergviola/Global.java
Basic Auth a whole Play 2.0 Application
View Global.java
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");
View NSManagedObject+Serialization.h
@interface NSManagedObject (Serialization)
- (NSDictionary*) toDictionary;
- (void) populateFromDictionary:(NSDictionary*)dict;
+ (NSManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict
inContext:(NSManagedObjectContext*)context;
@end
@fahied
fahied / gist:b1389a04a0207448aa50
Last active Aug 29, 2015
installing pod : permission denied
View gist:b1389a04a0207448aa50
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
View .gitignore
# 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 Jun 26, 2014
Play framework 2.x.x Best Practices
View play2
########### 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 Oct 6, 2015
Preparing APS Certificates for node-apn
View aps-node
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 Aug 29, 2015
GIT Cheatsheet
View gitcheat
# 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 Aug 26, 2014
jquery hash or query in UIWebview
View jquery-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];
You can’t perform that action at this time.