Skip to content

Instantly share code, notes, and snippets.

View aldakur's full-sized avatar
💭
Teaching & learning

Egoitz Gonzalez aldakur

💭
Teaching & learning
View GitHub Profile
@aldakur
aldakur / labur.js
Last active May 31, 2017 10:02
labur
jQuery(document).ready(function($) {
jQuery("#button_polr_get_url").click(function(){
var doc_pathname = '';
var suwp_pathname = document.location.pathname.split('/')[1];
// add the path element, if necessary
if( suwp_pathname == 'wp-admin' ) {
doc_pathname = '/wp-admin/admin-ajax.php';
} else {
@aldakur
aldakur / laburURL.sh
Created March 24, 2017 11:40
Script to use labur.eus service in console [bash]
curl --request GET 'https://labur.eus/api/v2/action/shorten?key=YOUR_API_KEYd&url=URL_YOU_WANT_TO_SHORTEN&is_secret=false'; echo '\n'
@aldakur
aldakur / laburURL.py
Last active March 24, 2017 11:41
Script to use labur.eus services in console [Python]
import requests
res = requests.get('https://labur.eus/api/v2/action/shorten?key=YOUR_API_KEYd&url=URL_YOU_WANT_TO_SHORTEN&is_secret=false')
shortened_url = res.text
print shortened_url
@aldakur
aldakur / wordpress_tips.php
Last active May 24, 2017 11:56
Wordpress tips
// BUCLE PARA POSTS
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
// Aqui codigo que se ejecutara cuando se encuentren articulos
<?php endwhile; else: ?>
// Aqui codigo que se ejecutara cunado no se encuentren articulos
<?php endif; ?>
// Para poder agregar plugins a nuestro tema es necesario las siguientes dos funciones.
// También hace que se vea la barra de arriba cuando estamos logeados en el blog
// header.php en el <head> antes de </head>
@aldakur
aldakur / ChangeTextViewSizeWithAsyncActivity.java
Created August 29, 2016 10:07
Change TextView Size using Asynctask
package service.webservice.facilito.codigo.com.ejemplocfwebservices;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
@aldakur
aldakur / TaskInParallelModeExample.java
Last active July 18, 2016 09:58
Run multiple threads in parallel mode and control the status with a progress bar
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import java.util.ArrayList;
@aldakur
aldakur / PorgressBarExample.java
Created July 18, 2016 09:16
Writing in a TextView numbers from 1 to 10, and display the progress bar during the process
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
public class PorgressBarExample extends AppCompatActivity {
@aldakur
aldakur / ThreadChangesInterface.java
Last active July 15, 2016 09:59
Thread that changes the user interface in the same (primary) thread
// [EU] Hari berdinean (app-aren hari nagusia) interfaze aldaketa burutzeko. Kasu honetan
// TextView baten aldaketa
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
@aldakur
aldakur / ThreadSleepyhead.java
Last active July 15, 2016 09:39
This class contain a thread that run a log every 3 seconds
// [ES] Hilo dormilón
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class ThreadSleepyhead extends AppCompatActivity {
@aldakur
aldakur / ThreadSleepyheadIndependentClass.java
Last active July 15, 2016 09:35
This file contain a thread as class that run a log every 3 seconds
// [ES] Hilo dormilón
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class ThreadSleepyheadIndependentClass extends AppCompatActivity {