This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const https = require('https'); | |
| let user = (name) => { | |
| const url = `https://www.instagram.com/${name}/?__a=1`; | |
| //return promise | |
| return new Promise((resolve, reject) => { | |
| const request = https.get(url, response => { | |
| if (response.statusCode < 200 || response.statusCode > 299) { | |
| //reject promise on error | |
| reject(new Error('Failed to load page, status code: ' + response.statusCode)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const https = require("https") | |
| // https request to api server | |
| https.get("https://api.github.com/users/parassharmaa", (response) => { | |
| //callback function which is asynchronous and non-blocking | |
| console.log(response.statusCode); | |
| }) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.4 | |
| RUN pip install Flask==0.10.1 uWSGI==2.0.8 | |
| WORKDIR /app | |
| COPY app /app | |
| CMD ["uwsgi", "--http", "0.0.0.0:9090", "--wsgi-file", "/app/server.py", \ | |
| "--callable", "app", "--stats", "0.0.0.0:9191"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import timeit | |
| from random import randint | |
| def selection_sort(l): | |
| for i in range(len(l)): | |
| j = i | |
| for k in range(i+1, len(l)): | |
| if l[k] < l[j]: | |
| j = k | |
| l[i], l[j] = l[j], l[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Testing for 100 items | |
| ----- | |
| Time Take by loop: 8.668698137626052e-05 | |
| Time Take by recursion: 0.00011143798474222422 | |
| Testing for 100 items | |
| ----- | |
| Time Take by loop: 8.37119878269732e-05 | |
| Time Take by recursion: 0.00011085800360888243 | |
| Testing for 10000 items | |
| ----- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| server_name <domain_name>.com www.<domain_name>.com; | |
| return 301 https://$server_name$request_uri; | |
| } | |
| server { | |
| listen 443 ssl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| host = "" | |
| username = "" | |
| password = "" | |
| directory_to_export = "" | |
| database = "" | |
| all_collections = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { AppRegistry, TextInput, View,Text, StyleSheet, Switch, TouchableOpacity } from 'react-native'; | |
| export default class UselessTextInput extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| emailOpt: true, | |
| pushOpt: true | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BowTie { | |
| public static void main(String args[]) { | |
| int n = Integer.parseInt(args[0]); | |
| for(int i=0; i<2*n+1; i++) { | |
| for(int j=0; j<2*n+1; j++) { | |
| if ((j>i && j<2*n-i) || (j>(2*n-i) && j<i && i>n)) | |
| System.out.print(" . "); | |
| else | |
| System.out.print(" * "); | |
| } |