Skip to content

Instantly share code, notes, and snippets.

View hmert's full-sized avatar
🎃
fintech

Hüseyin Mert hmert

🎃
fintech
View GitHub Profile
function format_number(n,prec,dec,sep) {
// Original by Luke Smith (http://lucassmith.name)
n = !isFinite(+n) ? 0 : +n;
prec = !isFinite(+prec) ? 2 : Math.abs(prec);
sep = sep == undefined ? ',' : sep;
var s = n.toFixed(prec),
abs = Math.abs(n).toFixed(prec),
_, i;
http://search.twitter.com/search.json?q=%40human_bot
{
"results": [{
"text": "@human_bot Are you feeling okay? Sounds like you've been smoking some crack with the way you've been talking lately.",
"to_user_id": 5740619,
"to_user": "human_bot",
"from_user": "taboularasa",
"id": 1306533155,
function formatNumber(n) {
if (!isFinite(n)) {
return n;
}
var s = ""+n, abs = Math.abs(n), _, i;
if (abs >= 1000) {
_ = (""+abs).split(/\./);
i = _[0].length % 3 || 3;
// Converts the content inside <script src="script2style.js">YOUR CSS</script>
// into a style block that will only be applied if js is turned on
(function () {
var d = document,
scripts = d.getElementsByTagName('script'),
me = scripts[scripts.length - 1],
head = d.getElementsByTagName('head')[0],
content = me.innerHTML.replace(/@import\((.*?)\);?/m,function (m,href) {
@icco
icco / gist:115279
Created May 21, 2009 04:41
Word count a web page with python
#!/usr/bin/python
import httplib
import httplibfrom operator import itemgetter
import re
def get_webpage(site,page):
conn = httplib.HTTPConnection(site)
conn.request("GET", page)
rd = conn.getresponse()
print rd.status, rd.reason
@gnuget
gnuget / gist:130856
Created June 16, 2009 19:57
get your ip address using python
#!/usr/bin/env python
import re
import urllib2
class get_ip:
def __init__(self):
pass
@maop
maop / gist:130864
Created June 16, 2009 20:12 — forked from gnuget/gist:130856
get your public ip
#!/usr/bin/env python
import urllib
def show_ip():
print urllib.urlopen("http://tuip.info/ip").read()
if __name__ == "__main__":
show_ip()
#!/usr/bin/python
#
# quick and dirty script to mauropm <3
# with love
# maop... xD
#
# Todo, parse types (mp3, youtube, etc..) and add code or perhaps
# feed youtube-dl with sources from here and later mencoder powa!
#
@ssokolow
ssokolow / boilerplate.py
Last active January 8, 2022 17:43
Python boilerplate from which I start all my projects
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""[application description here]"""
__appname__ = "[application name here]"
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__version__ = "0.0pre0"
__license__ = "GNU GPL 3.0 or later"
import logging
/*
* a smart poller for jquery.
* (by github)
*
* simple example:
*
* $.smartPoller(function(retry) {
* $.getJSON(url, function(data) {
* if (data) {
* doSomething(data)