Skip to content

Instantly share code, notes, and snippets.

View gs-akhan's full-sized avatar
😇

Azharuddin gs-akhan

😇
View GitHub Profile
@gs-akhan
gs-akhan / local.js
Created December 1, 2020 13:33
Local
let tags = `
<script src = "https://localhost:4200/runtime.js" />
<script src = "https://localhost:4200/polyfills.js" />
<script src = "https://localhost:4200/styles.js" />
<script src = "https://localhost:4200/vendor.js" />
<script src = "https://localhost:4200/main.js" />
`;
document.body.insertAdjacentHTML( 'beforeend', tags);
<!DOCTYPE html>
<html>
<head>
<title>Simple Charts</title>
</head>
<body>
</body>
<script type="text/javascript">
@gs-akhan
gs-akhan / index.js
Created April 9, 2017 21:58
Sending Data from WebView To React Native
//This sends data from WebView to React Native
...
<script>
window.postMessage("Sending data from WebView");
</script>
...
//In order to get data the was sent from WebView use onMessage prop on <WebView>
...
@gs-akhan
gs-akhan / Post Message
Last active April 9, 2017 21:53
Sending Data to WebView in React Native, Ex :
//This sends data from RN to webview
this.webview.postMessage("Hello from RN");
//to get this data into webview
...
<script>
@gs-akhan
gs-akhan / BorderedInput.js
Created October 13, 2015 14:40 — forked from danharper/BorderedInput.js
BorderedInput, with Material design style focus animation. Preview: https://i.imgur.com/Fek7rXF.gif
// note there may be a better way to abuse flexbox than this :)
var React = require('react-native')
var { View, TextInput } = React
var BorderedInput = React.createClass({
getInitialState() {
return { i: 0 }
},
@gs-akhan
gs-akhan / concurrent_sync.js
Last active August 29, 2015 14:27 — forked from laser/concurrent_sync.js
Modifying "sync" to do parallel stuff
function sync(gen) {
var iterable, resume, check, vals, ops;
vals = [];
ops = 0;
check = function() {
if (vals.length == ops) {
if (ops == 1) {
iterable.next(vals[0]);
@gs-akhan
gs-akhan / somethingAsync
Last active August 29, 2015 14:05
Simple Async handling
var uselessAsync = {};
uselessAsync.parallel = function(tasks, callback) {
var completed = 0;
var finalData = [];
var cb = function(err, data, iter) {
completed++;
//Server
var express = require('express');
var fs = require('fs');
var app = express();
var server = require('http').createServer(app).listen(5000);
var bus = require('bus.io')(server);
bus.io().on('connection', function(socket) {
console.log(socket.id);
socket.emit('echo', 'HERE IS MY BUS');
@gs-akhan
gs-akhan / gist:11192445
Created April 22, 2014 20:04
Dirty Promise Pattern
var Promise = function(inst) {
if (inst instanceof Promise) {
return inst;
}
else {
this.promises = [];
return this;
}
@gs-akhan
gs-akhan / gist:11189902
Created April 22, 2014 18:40
Grunt task to count the number of lines given from bunch of files
var fs = require('fs');
var path = require('path');
module.exports = function(grunt) {
grunt.registerMultiTask('linecounter', 'counts the number of lines in files', function( ) {
var count = 0;
var done = this.async();
this.files[0].src.forEach(function(a) {
console.log(a);
fs.createReadStream(a).on('data', function(chunk) {