Skip to content

Instantly share code, notes, and snippets.

View saurshaz's full-sized avatar

saurshaz saurshaz

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script data-require="jquery@2.1.3" data-semver="2.1.3" src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<link rel="stylesheet" href="style.css" />
<link data-require="bootstrap@3.3.2" data-semver="3.3.2" rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script data-require="bootstrap@3.3.2" data-semver="3.3.2" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
@saurshaz
saurshaz / react-sample-productlist.js
Created December 1, 2015 06:57
react code for product listinhg (incomplete without other components)
var React = require('react/addons');
var { PureRenderMixin } = React.addons;
var Fluxxor = require('fluxxor');
var StoreWatchMixin = Fluxxor.StoreWatchMixin;
var Utils = require ('../../Utils');
var EC = require('../../EventConstants');
const SubItem = require('./SubItem');
var ProductListView = React.createClass({
mixins: [
exports.init = function() {
Ti.Geolocation.purpose = 'Mileage Calculate';
checkGeoPermission();
Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
//
// SET ACCURACY - THE FOLLOWING VALUES ARE SUPPORTED
//

A directory structure i use for Node projects

  1. rootproject folder (starting point) 2. project_name folder 3. package.json file 4. node_modules folder (all dependencies) 4. .env file (or/and other non-committed environment/settings files) 5. project_name folder (the folder to contain source code) 6. appfolder (client side files)
  2. server folder (server side files)
@saurshaz
saurshaz / indexeddb-fetch.js
Created July 11, 2016 07:46
get data from indexeddb
// IndexedDB
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB,
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction,
dbVersion = 1.0;
// Create/open database
var request = indexedDB.open("local", dbVersion),
db,
createObjectStore = function (dataBase) {
// Create an objectStore
@saurshaz
saurshaz / webtask-github-sample.js
Last active July 31, 2016 05:56
A webtask to fetch alot of people related in similar stuff. a list of all people following all people that i follow (my siblings)
var async = require('async');
var GitHubApi = require("github@0.2.4");
// module.exports = function (ctx, done) {
// var words = ctx.data.title
// .split(' ')
// .concat(
// ctx.data.excerpt.split(' ')
// );
// MongoClient.connect(ctx.data.MONGO_URL, function (err, db) {
@saurshaz
saurshaz / aws-uploader.html
Last active October 3, 2016 15:50
aws-uploader riot component with server side code
const riot = require('riot')
<aws-uploader>
<div class='container'>
<form method="POST" action="/save-details">
<input type="file" id="file-input" onchange={initUpload}>
<p id="status">Please select a file</p>
<section if={opts.imagefile === 'true'}>
<img style="border:1px solid gray;width:300px;" id="preview" src="/images/default.png">
<input type="hidden" id="avatar-url" name="avatar-url" value="/images/default.png">
@saurshaz
saurshaz / index.html
Last active May 11, 2017 09:06
RxJS + fetch data + update UI// source http://jsbin.com/venijo
<style id="jsbin-css">
tr {
border-bottom: 1px solid black;
}
</style>
<meta name="description" content="RxJS + fetch data + update UI">
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script><h1>Hello, Rx.js!</h1>
<table>
<thead>
<tr>
@saurshaz
saurshaz / nginx-vhosts.config
Created July 17, 2020 12:08
nginx config for vhost setup to proxy for an app running at 3000
fastcgi_cache_path /var/cache/nginx/welcome.com_fastcgi levels=1:2 keys_zone=welcome.com_fastcgi:5m max_size=67108864;
server {
listen XXX.XX.XX.XX:80;
server_name example.com;
server_name www.example.com;
server_name ipv4.example.com;
error_page 400 "/error_docs/bad_request.html";
@saurshaz
saurshaz / gist:f6e1c2f5de71224bb675316a7a832730
Last active December 6, 2020 07:56
Gitpod and Expo setup
### Gitpod and Expo setup
#### The tunnel mode
- add `.gitpod.dockerfile` and `.gitpod.yml` from [here](https://github.com/saurshaz/react-native-expo-gitpod) to any expo project you open in gitpod.io
- Open Terminal then Write : --> expo start -c --tunnel
- the web one can run in preview only . by default `https://19006-e870944b-7af1-4ea4-ba25-ca6fa2a7bcb6.ws-us03.gitpod.io/` (the url will change .. this is my app's)
- YOu will be able to see the Just before the QR code on terminal their also exist a link something like this
"exp://n5-aev.anonymous.rn-composable-ui.exp.direct:80" (Change as per ur URL) Copy this link and open in mobile / YOU CAN DIRECTLY SCAN THE QR CODE BY OPENING EXPO APP AT you phone expo app