Skip to content

Instantly share code, notes, and snippets.

View code-shoily's full-sized avatar

Code Shoily code-shoily

  • Toronto, ON
  • 10:04 (UTC -12:00)
View GitHub Profile
@code-shoily
code-shoily / MainActivity.java
Created April 13, 2018 20:17 — forked from mksantoki/MainActivity.java
FileChooser in Android webview
/*
reference link ->https://www.opengeeks.me/2015/08/filechooser-and-android-webview/
https://github.com/OpenGeeksMe/Android-File-Chooser
*/
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
@code-shoily
code-shoily / MainActivity.java
Created April 13, 2018 20:17 — forked from mksantoki/MainActivity.java
FileChooser in Android webview
/*
reference link ->https://www.opengeeks.me/2015/08/filechooser-and-android-webview/
https://github.com/OpenGeeksMe/Android-File-Chooser
*/
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
(defmacro GET
[app route handler]
`(do
(with-decorator
(.route ~app ~route :methods ["GET"])
~handler)))
(defmacro POST
[app route handler]
`(do
package main
import "fmt"
type Func func()
func main() {
var callUs []Func
listOfNumbers := [...]int{1, 2, 3, 4, 5}
@code-shoily
code-shoily / number_sep.py
Last active July 22, 2016 16:46
Separates fuzzily given size input (i.e. 1cm x 2", 10.4' x 2mm x 11 1/4", 10 meter) etc. Units are irrelevant.
# HOLY FUCK I OVERDOSED MY MEDS, I'M FUCKED
def sanitize(n):
return n.strip().replace(" ", "").replace("\\", "/")
to_decimal = lambda n: "/" not in n and float(n) or float(n.split("/")[0])/float(n.split("/")[1])
def separate_dims(n):
separated = filter(None, re.findall(r'\d*\.?/?\\?\d*', n))
return separated, len(separated)
(import os sys django)
(defn setup []
(sys.path.insert 1 ".")
(os.environ.setdefault "DJANGO_SETTINGS_MODULE" "project.settings")
(django.setup)
(print "Hy <3 Django"))
##
# This is a cheap convenience I had to bake in 2/3 minutes, will turn into a Django custom command with more meat,
# optparse and templates.
# This is not to be taken seriously, I was just trying to accelerate the creation of some ClojureScrip :-)
##
import sys
import os
(defmacro cl-cond
[& others]
(if others
(let [more# (next others)
extra-clauses# (if more# `(cl-cond ~@more#))
clause# (first others)]
(if (= 2 (count clause#))
`(if ~(first clause#) ~(second clause#) ~extra-clauses#)
`(if ~(first clause#) ~(first clause#) ~extra-clauses#)))))
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import imaplib
import email
from email.header import decode_header
import HTMLParser
IMAP_ADDR = 'imap.gmail.com'
USERNAME = '<EMAIL_ADDRESS>'