Skip to content

Instantly share code, notes, and snippets.

View BlaShadow's full-sized avatar
🏠
Working from home

Luis BlaShadow

🏠
Working from home
View GitHub Profile
@BlaShadow
BlaShadow / Progressview.dart
Created May 22, 2021 17:04
Progress view using flutter
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
@BlaShadow
BlaShadow / HttpCall.swift
Created May 13, 2020 13:04
Swift HTTP Call
httpCall(url: 'http://worldtimeapi.org/api/timezone/Europe/Rome') { (result) in
print(result)
}
func httpCall(url: String, completion: @escaping (_: [String: Any]) -> Void) {
let url = URL(string: url)!
let task = URLSession.shared.dataTask(with: url) {(data, response, error) in
guard let data = data else { return }
@BlaShadow
BlaShadow / introrx.md
Created September 5, 2016 21:16 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@BlaShadow
BlaShadow / scrollState.java
Created December 19, 2013 18:29
How to know if list is scrooling down or up #Android
setOnScrollListener(new OnScrollListener(){
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
}
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
final ListView lw = getListView();
if(scrollState == 0)
Log.i("a", "scrolling stopped...");
@BlaShadow
BlaShadow / conf_unicorn
Created December 17, 2013 13:38
Configuration example gunicorn
[server:main]
use = gunicorn
host = 127.0.0.0
port = 5000
workers = 3
proc_name = proc_name
@BlaShadow
BlaShadow / validation.js
Created November 25, 2013 13:08
Num validation on key event with jQuery/Javascript
jQuery(document).on('keypress','[data-val="number"]',function(event){
var key = event.charCode;
if( ( key == 0 || (key < 58 && key > 46) ) == false )
return false;
});
@BlaShadow
BlaShadow / template.js
Created November 25, 2013 13:07
Template bing {{ value :) }}
var bindTemaplte = function(template,data)
{
for(key in data)
{
var reg = new RegExp('{{ ' + key + ' }}','g');
template = template.replace(reg,data[key]);
}
return template;
}
@BlaShadow
BlaShadow / val.js
Created November 22, 2013 03:40
Validation on keydown javascript
$('input[data-val=number]').on('keydown', function (event) {
var code = event.keyCode;
if ( (code < 48 || code > 57) && code !== 8 ) {
event.preventDefault();
return false;
}
});
import requests
import json
def login():
url = 'http://localhost/Service/service.svc/loginenduser/'
data = {'token': 'd8578edf8458ce06fbc5bb76a58c5ca4','email': 'mail@mail.com','password': '123456'}
headers = {'content-type': 'application/json'}
r = requests.post(url, data=json.dumps(data), headers=headers)
@BlaShadow
BlaShadow / gist:7404903
Last active December 27, 2015 23:19
run on startup service
chkconfig --levels 235 mysqld on
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
sysv-rc-conf apache2 on ( for new versions of ubuntu )