Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Limilabs.Mail;
using Limilabs.Client.IMAP;
namespace ConsoleApplication1
{
@nootanghimire
nootanghimire / gist:5658302
Last active December 17, 2015 19:09
Using Pop3 client to recieve emails. Uses MAil.dll | Must Import: >> Limilabs.Mail , Limilabs.Client.POP3
using (Pop3 client = new Pop3())
{
client.ConnectSSL("pop3.live.com");
client.UseBestLogin("username@something.com", "passwordhere");
List<string> uids = client.GetAll();
foreach (string uid in uids)
{
string email = client.GetMessageByUID(uid);
IMail em = new MailBuilder()
@nootanghimire
nootanghimire / webapp.js
Last active December 17, 2015 21:59
Trying to ue devisestorage api
(function () {
var pickAnything = document.querySelector("#pick-anything");
if (pickAnything) {
pickAnything.onclick = function() {
var storage = navigator.getDeviceStorage("sdcard");
cursor = storage.enumerate();
cursor.onerror = function() {
@nootanghimire
nootanghimire / gist_content1
Last active December 20, 2015 06:48 — forked from rhoit/tkinter py2→py3
tkinter py2 → py3
py2 → py3
Tkinter → tkinter
tkMessageBox → tkinter.messagebox
tkColorChooser → tkinter.colorchooser
tkFileDialog → tkinter.filedialog
tkCommonDialog → tkinter.commondialog
tkSimpleDialog → tkinter.simpledialog
tkFont → tkinter.font
Tkdnd → tkinter.dnd
ScrolledText → tkinter.scrolledtext
#ducky.py -- returns the first website searched by
#duckduckgo
#nootan.ghimire@gmail.com
import webbrowser
import sys
#print (sys.argv)
lst = sys.argv
@nootanghimire
nootanghimire / gist:6527881
Last active December 22, 2015 20:39
Get upto second child!
<?php
$q = "SELECT * FROM table WEHRE parent=0" ;
$res = mysql_query($q);
while ($row = mysql_fetch_array($res)){
$q1 = "SELECT * FROM table WHERE parent = ". $row['id'];
$res1 = mysql_query($q1);
while($row1 = mysql_fetch_array($res1){
$q2 = "SELECT * FROM table WHERE parent = ". $row1['id'];
$res2 = mysql_query($q2);
while($row2 = mysql_fetch_array($res2)){
@nootanghimire
nootanghimire / l10n-helper.js
Last active December 26, 2015 20:19
A localization mapping logic. Check http://jsfiddle.net/V92cK/5/ for a demo.
var Obj = '{"my":"मेरो","name": "नााम","is-xyz": "xyz-हो",".":"।","1":"१","2":"२","3":"३","4":"४","5":"५","6":"६","7":"७","8":"८","9":"९","0":"०"}';
//^^ The Localisation Objecy (Read from file or any other source)
ObjReal = JSON.parse(Obj); //Parsing the JSON
//The function starts
var l10n = function(localeObject, content){
var arr = content.split(" ").reverse(); //Split by space. and reverse (actually non-reversed) the order
@nootanghimire
nootanghimire / convert.php
Created November 7, 2013 06:45
Converts numbers into nepali
<?php
function convert($num){
$arr = array(०,१,२,३,४,५,६,७,८,९);
$newArr = array();
$sep = str_split($num); //implicit string conversion
foreach($sep as $key=>$value){
$newArr[$key] = $arr[$value];
}
return implode('',$newArr);
@nootanghimire
nootanghimire / trimfn.cpp
Last active December 31, 2015 04:09
Trim in C++
#include<iostream>
#include<cstring>
char* trim(char* str);
int main(){
return 1;
}
char* trim(char* str){
@nootanghimire
nootanghimire / postfix-eval-new.cpp
Last active May 29, 2018 05:11
Stack/Queue Implementation in C++ and Application in Expression Evaluations
/******************************************************
* @author Nootan Ghimire <nootan.ghimire@gmail.com>
* @file postfix-eval.cpp
* @desc Evaluation of Multi-Digit Postfix Expression
*****************************************************/
// C++ Includes
#include <iostream>
#include <cctype>
#include <cstdlib>