Skip to content

Instantly share code, notes, and snippets.

import 'dart:convert';
void main() {
String someJson = """{
"iceCreams": [
{
"flavor": "raspberry",
"color": "red"
},
{

Keybase proof

I hereby claim:

  • I am mnazim on github.
  • I am mnazim (https://keybase.io/mnazim) on keybase.
  • I have a public key whose fingerprint is 8B03 3276 1EC5 CC3F D331 E169 A5F8 963F ABD5 0D0A

To claim this, I am signing this object:

@mnazim
mnazim / 0_reuse_code.js
Created August 11, 2016 18:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import { Schema, arrayOf, normalize } from 'normalizr';
import { camelizeKeys } from 'humps';
import axios from 'axios';
const API_ROOT = 'http://localhost:5555/api/v1/';
// Fetches an API response.
// This makes every API response have the same shape, regardless of how nested it was.
function callApi(endpoint, method = 'get', data = {}, schema = null) {
const fullUrl = (endpoint.indexOf(API_ROOT) === -1) ? API_ROOT + endpoint : endpoint;
(function () {
var Modular = function () {
this.VERSION = '0.0.1',
this.modules = {},
this.activeModules = [],
this.currentPath = undefined,
this.registeredPaths = undefined,
this.host = undefined,
this.protocol = undefined;
};
@mnazim
mnazim / verifyemail.js
Created June 28, 2012 19:14 — forked from paularmstrong/verifyemail.js
Verify email addresses
var _ = require('underscore'),
exec = require('child_process').exec,
net = require('net'),
email = process.argv.splice(2)[0],
domain = email.split('@')[1];
function verify(mxrecord) {
console.log('connecting to', mxrecord);
var conn = net.createConnection(25, mxrecord),
commands = [
@mnazim
mnazim / learning_resources.markdown
Last active March 18, 2016 09:22
Open Source Web Development Learning Resources For Beginners and Freshers

Open Source Web Development Learning Resources For Beginners and Freshers

This place is a dump for learning online/offline resources. Aim is to create a curated list of resources.

Tools and Infrastructure

Basic Linux

@mnazim
mnazim / get_ordinal.php
Created July 28, 2011 19:26
Generate ordinal, easy way in PHP (see: http://blog.ikraftsoft.com/post/174637756/)
function get_ordinal($num) {
$temp_num = ($num > 31) ? ($num % 31) + 1 : $num;
return $num . date('S', mktime(0, 0, 0, $temp_num, 0, 0));
}
@mnazim
mnazim / forms.py
Last active September 26, 2015 14:37
Make Django forms.ChoiceField accept choices from a very large data set(see: http://blog.ikraftsoft.com/post/1342312823/)
from django import forms
list_of_choices = (
(1, 'Choice 1'),
(2, 'Choice 2'),
(3, 'Choice 3'),
# ...
(n, 'Choice n'),
)
class MyForm(forms.Form):
my_choice_field = forms.ChoiceField(choices=list_of_choices)
@mnazim
mnazim / The Error
Created July 28, 2011 18:00
Fix "can't find easy_install executable [Errno 2]" in virtualenv(see: http://blog.ikraftsoft.com/post/1397277718/fix-cant-find-easy-install-executable-virtualenv)
$ mkvirtualenv test
New python executable in ./bin/python
Installing distribute....................................................................................................................................done.
Complete output from command /home/mir/test/bin/python /home/mir/test/bin/easy_install /usr/share/python-virtualenv/p...ar.gz:
/home/mir/test/bin/python: can't open file '/home/mir/test/bin/easy_install': [Errno 2] No such file or directory
----------------------------------------
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 3, in
virtualenv.main()
File "/usr/lib/pymodules/python2.6/virtualenv.py", line 534, in main