Skip to content

Instantly share code, notes, and snippets.

View islahul's full-sized avatar

Islahul Hassan Zunjani islahul

View GitHub Profile
@islahul
islahul / delete-multiple-branches.md
Created September 20, 2016 12:47
Delete multiple branches

'fix/' is the pattern git branch | grep 'fix/' | xargs git branch -D

@islahul
islahul / react-double-colon-meaning-es6.js
Last active June 15, 2017 23:19
React double colon meaning JSX usage
import './login.styl';
import Component from '../components/component.react';
import React from 'react';
import exposeRouter from '../components/exposerouter.react';
import {focusInvalidField} from '../lib/validation';
@exposeRouter
export default class Login extends Component {
static propTypes = {
@islahul
islahul / Server management - Full stack learning kit - Part 1.md
Last active August 29, 2015 14:27
Links of tools and tutorials related to server management and deployment
@islahul
islahul / firebase_complex_query
Created July 14, 2015 10:11
Firebase Complex Query orderByChild() working slow
Problem:
Slow response on complex query method orderByChild("key")
Inspection:
Check the websocket frames on Chrome DevTools.
If it is loading unnecessary data, it means that Firebase is doing the query on client side. (Yes, it's not in the documentation but it does that)
Solution:
Add indexing in Security rules
@islahul
islahul / ionicPlatformDeregister.js
Created April 22, 2015 08:18
Unbind / Deregister Ionic registerBackButtonAction
// To solve weird android behaviors we need to manually implement Hardware back-button actions sometimes
// $ionicPlatform.registerBackButtonAction returns a deregister function
var deregisterFunction = $ionicPlatform.registerBackButtonAction(backButtonAction, 500);
// Example way of unbinding
if(something === false) {
deregisterFunction();
}
// Or if registered for a particular view / page
@islahul
islahul / fgetcsv_line_ending.php
Last active August 29, 2015 14:14
PHP: fgetcsv function, CSV upload/read failing to detect line endings on Mac
<?php
// Solution: http://php.net/manual/en/filesystem.configuration.php#ini.auto-detect-line-endings
ini_set("auto_detect_line_endings", true);
// In a Wordpress plugin
@ini_set("auto_detect_line_endings", true);
?>
@islahul
islahul / uri_difference_rails_js.md
Last active August 29, 2015 14:13
URI Encoding difference between Rails and JavaScript on handling Hash

Rails

> URI.encode('http://localhost/asflm#aflskm?lkml=klm#lkml')

"http://localhost/asflm%23aflskm?lkml=klm%23lkml"

In Rails use Addressable::URI.escape directly to perform a great encoding taking care of all parts of url

> Addressable::URI.escape('http://local/as host/asflm#aflskm?lkml=kl m#lkml')