Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Azat Mardan azat-co

🎯
Focusing
Block or report user

Report or block azat-co

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View server.js
const http = require('http')
http.createServer((req, res)=>{res.end(`Happy Monday America!
Your Node environment is ${process.env.NODE_ENV}
`)}).listen(80)
View convert-to-mp4.sh
#!/bin/bash
MODsuff=MOD
MP4suff=mp4
for src in `ls -d *.MOD` ;
do
dest=${src%.$MODsuff}.$MP4suff
echo Converting $src to $dest...
`./ffmpeg -i "$src" -s 720x405 -vcodec mpeg4 -b 2300k -deinterlace -strict -2 -aspect 16:9 -acodec aac -ab 192k -ar 44100 "$dest"`
@azat-co
azat-co / asana-hello-world.js
Created Nov 18, 2014
Asana Hello World Node API Example
View asana-hello-world.js
var request = require('request')
var apiKey = process.env.API_KEY
var workspaceId = process.env.WORKSPACE
var assigneeEmail = process.env.ASSIGNEE
var url ='https://app.asana.com/api/1.0/tasks'
// set up the request
var headers = {
'Authorization': 'Basic '+ new Buffer(apiKey).toString('base64')
View bookmarklet
//Executed through a self-invoking anonymous function
(function(){
//declare the variables that we will need
var imgName = "10584590_588581994607732_199003263_n.jpg";
var uriA = "http://photos-e.ak.instagram.com/hphotos-ak-xfa1/10584590_588581994607732_199003263_n.jpg";
var uri1 = "http://instagram.com/p/sLLSiTCXB5/?modal=true";
var uri2 = "http://instagram.com/p/sLLSiTCXB5/";
@azat-co
azat-co / express.js
Last active Aug 19, 2018
Tutorial: REST API with Node.js and MongoDB using Mongoskin and Express.js
View express.js
var express = require('express')
, mongoskin = require('mongoskin')
var app = express()
app.use(express.bodyParser())
var db = mongoskin.db('localhost:27017/test', {safe:true});
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
@azat-co
azat-co / JSFUN.md
Last active Jun 10, 2017
JavaScript FUNdamentals
View JSFUN.md

JS FUNdamentals

If it's not fun, it's not JavaScript.

Expressiveness

Programming languages like BASIC, Python, C has boring machine-like nature which requires developers to write extra code that's not directly related to the solution itself. Think about line numbers in BASIC or interfaces, classes and patterns in Java.

On the other hand JavaScript inherits the best traits of pure mathematics, LISP, C# which lead to a great deal of expressiveness (and fun!).

@azat-co
azat-co / jquery-api.md
Last active Aug 29, 2019
The list of most commonly used jQuery API functions
View jquery-api.md

Here is the list of most commonly used jQuery API functions:

  • find(): Selects elements based on the provided selector string
  • hide(): Hides an element if it was visible
  • show(): Shows an element if it was hidden
  • html(): Gets or sets an inner HTML of an element
  • append() Injects an element into the DOM after the selected element
  • prepend() Injects an element into the DOM before the selected element
  • on(): Attaches an event listener to an element
  • off() Detaches an event listener from an element
@azat-co
azat-co / file-structure
Created Jun 6, 2013
Instagram Gallery: A demo app build with Storify API and Node.js http://storify.com/storifydev/instagram-gallery/
View file-structure
- index.js
- package.json
- public/js/main.js
- public/index.html
- css/bootstrap-responsive.min.css
- css/flatly-bootstrap.min.css
@azat-co
azat-co / leanpub-tool.js
Created May 29, 2013
LeanPub Tool — Node.js script for sanitizing and compiling a book's manuscript. LeanPub uses multi-file book format and a special markdown markup (that confuses Marked app). I found that to convert to MS Word (for editing and other needs) this workflow is the best: 1. run leanpub-tool.js with node.js (node leanpub-tool.js) 2. open file in Marked…
View leanpub-tool.js
var fs = require('fs');
//change these to YOUR filenames
//probably we can read it from Book.txt but I was too lazy to implement it :-) and somebody might want to compile only sertain parts of the book
var book =[
"frontmatter.txt",
"mainmatter.txt",
"part1.txt",
"chapter1.txt",
"part2.txt",
"chapter2.txt",
@azat-co
azat-co / derby-app.html
Created May 7, 2013
Node.js MVC: Express.js and Derby Hello World Tutorial
View derby-app.html
<Body:>
<input value="{message}"><h1>{message}</h1>
You can’t perform that action at this time.