Skip to content

Instantly share code, notes, and snippets.

View tatocaster's full-sized avatar
🇺🇦

Merab Tato Kutalia tatocaster

🇺🇦
View GitHub Profile
@tatocaster
tatocaster / Preferences.sublime-settings
Last active January 2, 2016 07:19
Sublime Text 3 User Settings on Ubuntu Linux
{
// "color_scheme": "Packages/Color Scheme - Default/Dawn.tmTheme",
"color_scheme": "Packages/Theme - Brogrammer/brogrammer.tmTheme",
"fade_fold_buttons": true,
"find_selected_text": true,
"font_face": "Consolas",
"font_options":
[
"subpixel_antialias",
"gray_antialias"
@tatocaster
tatocaster / magtifun_sms_python.py
Last active April 22, 2016 12:35
Conntect to magtifun, using python and send desired sms
def magti_send_sms(sms, mobile):
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
url_1 = 'http://www.magtifun.ge/index.php?page=11&lang=ge'
values = dict(password='password', user='user', act='1')
data = urllib.urlencode(values)
req = urllib2.Request(url_1, data)
rsp = urllib2.urlopen(req)
@tatocaster
tatocaster / magtifun_sms_terminal.py
Last active April 22, 2016 12:36
magtifun sender from terminal (python)
import urllib,urllib2,cookielib
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
url_1 = 'http://www.magtifun.ge/index.php?page=11&lang=ge'
values = dict(password='Password', user='User', act='1')
data = urllib.urlencode(values)
req = urllib2.Request(url_1, data)
@tatocaster
tatocaster / detection.js
Last active April 22, 2016 12:34
javascript, detect seconds between keypress
milliseconds = 0;
timeHandle = null;
window.onkeypress = function(){
clearInterval(timeHandle);
if (milliseconds > 0){
console.log('passed ' + milliseconds*10 + ' milliseconds');
milliseconds = 0;
}
timeHandle = setInterval(function(){
milliseconds++;
@tatocaster
tatocaster / immediately invoked function
Last active August 29, 2015 14:15
js scopes in for loop
/**
* given expression
*/
var run = function(){
var arr = [];
for(var i = 0; i<=10; i++){
arr.push(function(){
@tatocaster
tatocaster / mixins.styl
Last active August 29, 2015 14:19
My simple mixins for stylus
vendor(name, argument) {
-webkit-{name} argument
-moz-{name} argument
-ms-{name} argument
-o-{name} argument
{name} argument
}
border-radius()
vendor('border-radius', arguments)
background-image()
@tatocaster
tatocaster / flashdetect.js
Created May 6, 2015 13:58
Detect Flash in browsers
function hasFlash(){
var hasFlash = false;
try {
hasFlash = Boolean(new ActiveXObject('ShockwaveFlash.ShockwaveFlash'));
} catch(exception) {
hasFlash = ('undefined' != typeof navigator.mimeTypes['application/x-shockwave-flash']);
}
return hasFlash;
}
<!DOCTYPE html>
<html>
<head>
<title>Canvas</title>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script type="text/javascript">
@tatocaster
tatocaster / index.html
Last active September 23, 2015 21:29
Rotating Arc on canvas https://tatocaster.me/arc.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rotating Arc on canvas</title>
</head>
<body>
<canvas id="canvas" width="400" height="150"></canvas>
<script type="text/javascript" src="script.js"></script>
</body>
@tatocaster
tatocaster / RealPathUtil.java
Last active May 5, 2024 16:59
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {