Skip to content

Instantly share code, notes, and snippets.

@rishabhp
rishabhp / benchmark.md
Last active April 3, 2018 04:36
MySQL online schema migration benchmarks
View benchmark.md
mysql> select count(*) from users;
+----------+
| count(*) |
+----------+
| 25305798 |
+----------+
1 row in set (10.24 sec)

# Inplace, rebuilds table, allows DML
@rishabhp
rishabhp / ruby_autoload.md
Last active September 5, 2016 09:59
Ruby Autoloading (probably what Rails does as well)
View ruby_autoload.md

Post.rb

class Post
  def self.all
    puts Time.now.to_f
    'Post@all'
  end
end
@rishabhp
rishabhp / laravel_repository.md
Last active August 18, 2016 10:36
Repository Pattern (Laravel)
View laravel_repository.md
// Interface/Contract
interface OrderRepositoryInterface {
  public function getAll();
  public function find($id);
}

class DbOrderRepository implements OrderRepositoryInterface {

 public function getAll()
View flatten.md

Problem:

var input = {
    Foo: {
        Bar: {
            Hello: 2
        },
        World: 3
    },
@rishabhp
rishabhp / 1_react_es6.jsx
Last active April 10, 2016 09:23
React JSX to JS (ES5 and ES6) Transpilation Examples
View 1_react_es6.jsx
let styles = {
backgroundColor: '#fefefe',
color: '#ff0000'
}
class App extends React.Component {
render() {
return (
<div style={styles}>
@rishabhp
rishabhp / react_es5.js
Created April 10, 2016 09:18
JSX to JS (ES5 and ES6) Transpilation Sample
View react_es5.js
let styles = {
backgroundColor: '#fefefe',
color: '#ff0000'
};
let App = React.createClass({
displayName: 'App',
render: function () {
@rishabhp
rishabhp / js_mixins.md
Last active August 29, 2015 14:23
Mixins in JavaScript
View js_mixins.md
@rishabhp
rishabhp / frontend_concepts.md
Last active August 29, 2015 14:22
Important Frontend (HTML/CSS/JS) Concepts to Understand
@rishabhp
rishabhp / android_binder_terminology.md
Created January 9, 2015 11:49
Binder Terminology
View android_binder_terminology.md

Binder Terminology

Binder framework

Binder (Framework)

The overall IPC architecture

Binder Driver

The kernel-level driver that fascinates the communication across process boundaries

@rishabhp
rishabhp / android_quick_gcm.md
Created January 6, 2015 06:40
Quick GCM Implementation in Android
View android_quick_gcm.md

Quick code to implement/test GCM in an Android Activity

// Custom Push Notifications

String SENDER_ID = "SENDER_ID_FROM_GOOGLE_DEV_CONSOLE";

String regId;

String PROPERTY_REG_ID = "registration_id";