Skip to content

Instantly share code, notes, and snippets.

View itaditya's full-sized avatar
🎯
Focusing

Aditya Agarwal itaditya

🎯
Focusing
View GitHub Profile
@itaditya
itaditya / gistEmbed.html
Last active June 28, 2016 10:33
We r gonna embed a gist
<!--We r gonna embed a gist-->
<script src="https://gist.github.com/itaditya/04f961e6648734ba2df1cf506b0f9f1c.js"></script>
background: linear-gradient(75deg, #75a196, #131817);
background-size: 400% 400%;
-webkit-animation: AnimationName 24s ease infinite;
-moz-animation: AnimationName 24s ease infinite;
-o-animation: AnimationName 24s ease infinite;
animation: AnimationName 24s ease infinite;
@-webkit-keyframes AnimationName {
0%{background-position:40% 0%}
hello asynchronous
@itaditya
itaditya / examples-naive.js
Last active July 2, 2017 05:28
Mongoose functions
User.find({
verified: false
}).exec(function (err, users) {
var n = users.length;
for (var i = 0; i < n; i++) {
var user = users[i];
sendEmail(user.email);
}
})
@itaditya
itaditya / passport_node_acl_example.js
Last active November 4, 2017 05:09 — forked from danwit/passport_node_acl_example.js
Authentication and authorization with passportjs + node_acl + mongo + express + es6
const express = require('express'),
mongodb = require('mongodb'),
passport = require('passport'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
methodOverride = require('method-override'),
session = require('express-session'),
node_acl = require('acl'),
app = express(),
localStrategy = require('passport-local').Strategy;
const barker = (state) => ({
bark: () => console.log('Woof, I am ' + state.name)
})
const driver = (state) => ({
drive: () => state.position = state.position + state.speed
})
const killer = (state) => ({
kill: (enemy) => console.log('I killed ' + enemy)
})
@itaditya
itaditya / index.js
Created January 24, 2018 06:28
Code in Nodejs to create a file on github using Github REST API
const request = require('superagent');
const base64 = require('base-64');
const BASE_URL = 'https://api.github.com';
const TOKEN = 'BOT_ACCESS_TOKEN';
(async() => {
const COMMIT_MSG = process.argv[2];
const FILE_CONTENT = process.argv[3];
function withAuthentication(WrappedComponent) {
const ModifiedComponent = (props) => {
if (!props.isAuthenticated) {
return <Redirect to="/login" />;
}
return (<WrappedComponent { ...props } />);
};
const mapStateToProps = (state) => ({
@itaditya
itaditya / gsoc-new-orgs.txt
Last active February 14, 2018 12:56
All the *new* orgs which participate in GSOC 2018
0 - 3DTK
1 - 52° North Initiative for Geospatial Open Source Software GmbH
2 - Berkman Klein Center for Internet &amp; Society at Harvard University
3 - Canadian Centre for Computational Genomics
4 - Center for Research In Open Source Software (CROSS) at UC Santa Cruz
5 - CGAL Project
6 - CHAOSS: Community Health Analytics Open Source Software
7 - CiviCRM LLC
8 - Cuneiform Digital Library Initiative
9 - Debian Project