Skip to content

Instantly share code, notes, and snippets.

File folder = new File(Environment.getExternalStorageDirectory() +
File.separator + "TollCulator");
boolean success = true;
if (!folder.exists()) {
success = folder.mkdirs();
}
if (success) {
// Do something on success
} else {
// Do something else on failure
void main() {
var arr = [10,9,8,3,2,1,0];
print(arr);
arr.sort((a,b)=>a-b);
print(arr);
}
@onlyangel
onlyangel / gist:a6cb8a32d8b7b3c25768
Created October 15, 2014 02:52
Import a csv to mysql
load data local infile 'uniq.csv' into table tblUniq fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(uniqName, uniqCity, uniqComments)
var domain = "";
//var domain = "http://secure.tok3n.com";
/*
Tok3n Core
*/
//Get a session/transaction ID for this atempt of ussage of the API. Very important for security reasons.
function getSessionId(publicKey,userKey){
# AppScale
#
# VERSION 0.0.1
# Based on the file of Chris Bunch <chris@appscale.com> @ http://www.appscale.com/blog/2013/10/30/appscale-on-docker/
FROM ubuntu
MAINTAINER Jose Angel Espinoza Portillo <jose@ngel.es
# First, update the apt-get
RUN apt-get update
@onlyangel
onlyangel / paravictor.dart
Created November 13, 2013 02:00
Para victor y su prueba de inputTexts
import 'dart:html';
void main() {
querySelectorAll("input:not([value]),input[value='']").forEach((Element e)=>e.classes.add("empty"));
querySelectorAll("input").forEach((InputElement e){
e
..onInput.listen((ev)=>changeClasss(e))
..onKeyUp.listen((ev)=>changeClasss(e));
});
}
@onlyangel
onlyangel / gist:7094405
Created October 22, 2013 02:41
Una implementaion de curl en php
$fields = "XML=" . urlencode($xmlString);
// in this example, POST request was made using PHP's CURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $postUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
@onlyangel
onlyangel / gist:6984143
Created October 14, 2013 23:38
install all a php server needs
sudo apt-get install mysql-server mysql-client apache2 php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
void main() {
final mapOptions = new MapOptions()
..zoom = 15
..center = new LatLng(19.44059, -99.17000)
..mapTypeId = MapTypeId.ROADMAP;
final map = new GMap(query("#map-canvas"), mapOptions);
var circleOptions = new CircleOptions()
..strokeColor = "#006600"
@onlyangel
onlyangel / gist:5001928
Created February 21, 2013 04:06
Titanium error when compiling to android
[INFO] logfile = /Users/onlyangel/Dropbox/proyectos/repositorios/Arqui/Aqrui/build.log
[DEBUG] /Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/android/builder.py install Aqrui /SDKs/android-sdk /Users/onlyangel/Dropbox/proyectos/repositorios/Arqui/Aqrui com.onlyangel.lds.arqui 2
[DEBUG] detected module analytics, path = /Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/android/modules/titanium-analytics.jar
[DEBUG] detected module android, path = /Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/android/modules/titanium-android.jar
[DEBUG] adding required library: jaxen-1.1.1.jar
[DEBUG] adding required library: ti-commons-codec-1.3.jar
[DEBUG] adding required library: kroll-common.jar
[DEBUG] adding required library: titanium.jar
[DEBUG] detected module app, path = /Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/android/modules/titanium-app.jar
[DEBUG] detected module ui, path = /Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/android/modules/tita