Skip to content

Instantly share code, notes, and snippets.

View nazimamin's full-sized avatar
👨‍💻
<code>everything</code>

Nazim Amin nazimamin

👨‍💻
<code>everything</code>
View GitHub Profile
@nazimamin
nazimamin / JS.vsc-template.js
Created June 8, 2019 21:51
My .vsc-template to scaffold quickly
(function Template() {
const camelize = str =>
str.replace(/\W+(.)/g, (_match, chr) => chr.toUpperCase());
return {
userInputs: [
{
title: 'Enter the component name',
argumentName: 'name',
defaultValue: 'HomeComponent'
}
@nazimamin
nazimamin / ModalAnimation.js
Last active March 29, 2018 21:25
ModalAnimation.js
const MIDDLE_OF_THE_SCREEN_OFFSET = SCREEN_HEIGHT/2 - 120;
//initially
this.modalAnimation = new Animated.ValueXY({
x: 0,
y: MIDDLE_OF_THE_SCREEN_OFFSET
});
//responser
onPanResponderRelease: (e, gestureState) => {
@nazimamin
nazimamin / cloudSettings
Last active November 30, 2019 22:53
My Visual Studio Code settings and extensions
{"lastUpload":"2019-11-30T22:53:19.044Z","extensionVersion":"v3.4.3"}
//get quotes fro https://worldhistoryproject.org/topics/mahatma-gandhi
var items = document.getElementsByClassName("media-list")[0].children;
for (var item in items) {
var time = item.children[0].textContent;
var mediaHeading = item.children[1].children[1].children[0].innerText;
var link = item.children[1].children[1].children[0].getAttribute("href");
const output = `<li>
<a href="https://worldhistoryproject.org${link}">
<b>${time.trim()}</b> - ${mediaHeading}.
@nazimamin
nazimamin / automate-task.applescript
Created September 6, 2016 07:33
automator: Launch terminal from right click & close duplicate windows
on run {input, parameters}
tell application "Terminal"
close (every window whose name contains "PokemonGo-bot")
end tell
tell application "System Events" to tell process "Terminal"
if exists (sheet 1 of window 1) then
tell application "System Events" to click UI element "Terminate" of sheet 1 of window 1 of application process "Terminal"
end if
end tell
tell application "Terminal"
@nazimamin
nazimamin / mass-youtube-dl.js
Last active August 31, 2016 02:58
mass download videos from youtube
var HOST = 'https://###.firebaseio.com/items.json'
var fs = require('fs')
var datapath = __dirname + '/videos'
var exec = require("child_process").execSync
var request = require('request')
request(HOST, function (err, res, body) {
if (res.statusCode == 200) {
var result = JSON.parse(body);
for (var key in result) {
@nazimamin
nazimamin / ratemyprofessor-school-list.json
Created August 25, 2016 21:28
list of schools from rate my professor search.mtvnservices.com
request = http://search.mtvnservices.com/typeahead/suggest/?solrformat=true&q=s&rows=500&defType=edismax&bq=schoolname_sort_s%3A%22s%22%5E1000&qf=schoolname_autosuggest&bf=pow%28total_number_of_ratings_i%2C1.9%29&sort=score%2Bdesc&siteName=rmp&rows=500&group=off&group.field=content_type_s&group.limit=500&fq=content_type_s%3ASCHOOL
response = {
"responseHeader": {
"status": 0,
"QTime": 2
},
"response": {
"numFound": 2268,
"start": 0,
"docs": [{
req = http://www.ratemyprofessors.com/api/professors/1047122/ratings // comprehensive
req = http://www.ratemyprofessors.com/api/professors/925226/ratings?page=1 // comprehensive
req = http://www.ratemyprofessors.com/api/professors/925226/ratingsbyclass //list of ratings sorted by class
req = http://www.ratemyprofessors.com/api/professors/925226 // overall meta
results = {
"id": 1047122,
"fName": "Jennifer",
"lName": "Wong-Ma",
"middleInitials": "",
"fullName": "Jennifer Wong-Ma",
@nazimamin
nazimamin / fileUpload.py
Last active June 11, 2019 00:22
File uploading using flask
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg'])
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
UPLOAD_FOLDER = os.path.join(APP_ROOT, 'static/uploads')
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
# example taken from http://flask.pocoo.org/docs/0.10/patterns/fileuploads/
def allowed_file(filename):
return '.' in filename and \