Skip to content

Instantly share code, notes, and snippets.

View akshayrajp's full-sized avatar
The grind must go on.

Akshay Rajpurohit akshayrajp

The grind must go on.
View GitHub Profile
@zmts
zmts / imageSize.md
Created June 6, 2020 16:48
Get image width and height with JavaScript

Get image width and height with JavaScript

function imageSize (image) {
  return new Promise((resolve, reject) => {
    try {
      const fileReader = new FileReader()

      fileReader.onload = () => {
 const img = new Image()
@itswadesh
itswadesh / textlocal.js
Created December 17, 2016 14:21
Send sms using NodeJS from India (https://www.textlocal.in/)
var http = require('http');
var urlencode = require('urlencode');
var msg = urlencode('hello js');
var toNumber = 'TO_PHONE_NO';
var username = 'TEXTLOCAL_USER_EMAIL';
var hash = 'TEXTLOCAL_USER_HASH'; // The hash key could be found under Help->All Documentation->Your hash key. Alternatively you can use your Textlocal password in plain text.
var sender = 'txtlcl';
var data = 'username=' + username + '&hash=' + hash + '&sender=' + sender + '&numbers=' + toNumber + '&message=' + msg;
var options = {
host: 'api.textlocal.in', path: '/send?' + data
@klange
klange / _.md
Last active August 22, 2024 14:20
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le