Skip to content

Instantly share code, notes, and snippets.

View adnaan's full-sized avatar
🎯
Focusing

Adnaan Badr adnaan

🎯
Focusing
View GitHub Profile
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET
/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@adnaan
adnaan / mywebframework.go
Last active December 23, 2015 09:59
mywebframework
package mywebframework
import (
"bytes"
"fmt"
"github.com/garyburd/redigo/redis"
"html/template"
"io/ioutil"
"labix.org/v2/mgo"
"net"
@adnaan
adnaan / cpuinfo
Created February 3, 2015 06:01
cpu info
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
stepping : 7
cpu MHz : 1258.375
cache size : 12288 KB
physical id : 0
siblings : 12
@adnaan
adnaan / repo-apply.sh
Last active August 29, 2015 14:17 — forked from gipi/repo-apply.sh
#!/bin/sh
## Script to patch up diff reated by `repo diff`
# from https://groups.google.com/d/msg/repo-discuss/43juvD1qGIQ/7maptZVcEjsJ
if [ -z "$1" ] || [ ! -e "$1" ]; then
echo "Usages: $0 <repo_diff_file>";
exit 0;
fi
rm -fr _tmp_splits*
@adnaan
adnaan / script.sh
Last active September 25, 2019 13:02
Parse and execute a simple bash script.
ls -la
echo "hello"
tree
adb devices
adb wait-for-device #example of a long running task
app.model({
namespace: 'products',
state: {
list: [],
loading: false,
},
subscriptions: {
setup({ dispatch }) {
dispatch({ type: 'query' });
},
@adnaan
adnaan / api.go
Created November 1, 2016 15:56
Products API Server
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net"
"net/http"
"os"
@adnaan
adnaan / index.js
Created November 1, 2016 16:21
popular-products/src/index.js
/*@flow*/
import React from 'react';
import { Router, Route } from 'dva/router';
import dva from 'dva';
import App from './App';
import model from './model';
import './index.css';
const app = dva();
app.model(model);
@adnaan
adnaan / App.0.js
Created November 1, 2016 16:25
Default App.js
import React from 'react';
import logo from './logo.svg';
import './App.css';
const App = function() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
reducers:{
query(state,{ payload }) {
return { ...state };
},
querySuccess(state, { payload }) {
return { ...state };
},
vote(state, { payload }) {
return { ...state };
},