Skip to content

Instantly share code, notes, and snippets.

View mii9000's full-sized avatar

ibrahim mii9000

View GitHub Profile
@mii9000
mii9000 / japan-jobs.md
Created October 7, 2017 11:42 — forked from davidcalhoun/japan-jobs.md
Foreigner-friendly software companies in Japan
@mii9000
mii9000 / annoying.js
Created February 9, 2017 08:16 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
/*
Template
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.22/rx.all.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
import { enableProdMode, NgModule, ApplicationRef, provide, ExceptionHandler } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { BrowserModule } from '@angular/platform-browser';
import { Http, XHRBackend, RequestOptions, HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { routing } from './app/app.routing';
import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
import * as pages from './app';
import * as components from './app/shared/components';
@mii9000
mii9000 / Generic TypeScript Angular 1.X BaseController
Last active October 9, 2018 19:31 — forked from foyzulkarim/Generic TypeScript Angular 1.X BaseController
Generic TypeScript Angular 1.X Controller (Base+Child)
module App {
export class BaseController<T extends Entity> {
// my services
searchService: SearchService;
saveService: SaveService;
authService: AuthService;
url: UrlService;
// my variables
searchRequest: SearchRequest;
@mii9000
mii9000 / htmlentity.js
Created May 25, 2016 08:47 — forked from CatTail/htmlentity.js
Javascript: encode(decode) html text into html entity
// encode(decode) html text into html entity
var decodeHtmlEntity = function(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
});
};
var encodeHtmlEntity = function(str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {
@mii9000
mii9000 / 1_query_timestamp.js
Created May 12, 2016 07:40 — forked from katowulf/1_query_timestamp.js
Get only new items from Firebase
// assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP)
// pros: fast and done server-side (less bandwidth, faster response), simple
// cons: a few bytes on each record for the timestamp
var ref = new Firebase(...);
ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) {
console.log('new record', snap.key());
});
@mii9000
mii9000 / README.md
Created May 11, 2016 10:31 — forked from aaronk6/README.md
launchUri

Cross-browser implementation of navigator.msLaunchUri

Microsoft’s navigator.msLaunchUri method only works in Internet Explorer on Windows 8. Therefore I came up with a (nearly) cross-browser implementation that uses the native msLaunchUri when it’s available and falls back to adventurous hacks when running in other browsers.

Description

launchUri (uri, successCallback, noHandlerCallback, unknownCallback)
@mii9000
mii9000 / common-fail-handle.js
Created March 24, 2016 14:52
Common error handler for same type of Promise returning functions
aFunctionThatReturnPromise({ shiftid: event.shiftId, status: 'approve' })
.done(function () {
//Do somehting when the promise succeeds
})
.fail(failHandler);
//Common function for fail handling
function failHandler(msg, res){
alert(msg);
@mii9000
mii9000 / WebConfigFont.xml
Created March 24, 2016 14:35
Fonts not being served from ASP.NET MVC app hosted in IIS which can be resolved by adding the following inside web.config's system.webServer element.
<staticContent>
<mimeMap fileExtension=".woff2" mimeType="font/x-woff" />
</staticContent>