Skip to content

Instantly share code, notes, and snippets.

Avatar

Ignacio Rivas sabarasaba

View GitHub Profile
@sabarasaba
sabarasaba / howto.md
Last active Dec 25, 2015
Debugging webapps in Android default browser
View howto.md

Install the weinre module from npm:

$ sudo npm -g install weinre

In your index.html add the following line before closing the head section:

<script src="http://your-local-ip:8081/target/target-script-min.js#anonymous"></script>
View index.js
var o = '{ "user": "tu vieja", "posts": [ { "title": "title 1", "contents": "..." }, { "title": "title 2", "contents": "..." } ] }';
var fetchShit = function() {
var def = $.Deferred();
setTimeout(function() {
def.resolve(o);
}, 2000);
return def.promise();
@sabarasaba
sabarasaba / gist:3975451
Created Oct 29, 2012
Get the current State of the user.
@sabarasaba
sabarasaba / gist:3080590
Created Jul 10, 2012
Remove directory from remote repository after adding them to .gitignore
View gist:3080590
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@sabarasaba
sabarasaba / gist:1387550
Created Nov 23, 2011
Setting a timeout for the file_get_contents function
View gist:1387550
<?php
// Create the stream context
$context = stream_context_create(array(
'http' => array(
'timeout' => 3 // Timeout in seconds
)
));
// Fetch the URL's contents
@sabarasaba
sabarasaba / gist:1362220
Created Nov 13, 2011
Get first url video that matches with the given text
View gist:1362220
<?php
function getYoutubeLink($title)
{
@$videoName = ereg_replace('[[:space:]]+', ' ', trim($videoName));
$videoName = urlencode($videoName);
// generate feed URL
$feedURL = "http://gdata.youtube.com/feeds/api/videos?vq={$videoName}";
@sabarasaba
sabarasaba / gist:1361520
Created Nov 13, 2011
Delete duplicates from a mysql table.
View gist:1361520
DELETE FROM someTable
USING someTable, someTable as virtualTable
WHERE (NOT someTable.id = virtualTable.id)
AND (someTable.name = virtualTable.name)