Skip to content

Instantly share code, notes, and snippets.

View 64lines's full-sized avatar

Julian Alexander Murillo 64lines

  • Huge Inc.
  • Medellin - Colombia
View GitHub Profile
@64lines
64lines / facebook_dynamic_sharing.js
Last active January 4, 2016 07:49
Share currrent page on Facebook
function shareOnFacebookButton() {
var dynamicUrl = "https://www.facebook.com/sharer/sharer.php"
+ "?"
+ "u=" + window.location.href;
var fbButton = document.createElement("a");
fbButton.id = "facebook-url";
fbButton.href = dynamicUrl;
fbButton.innerText = "Share on Facebook";
document.body.appendChild(fbButton);
@64lines
64lines / createXMLHttpRequest.js
Last active August 29, 2015 14:00
[AJAX] - XMLHttpRequest
function createXMLHttpRequest() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "url"); // Method GET or POST
xhr.onload = function(e) {
console.log(xhr.responseText);
};
xhr.send();
}
@64lines
64lines / Convert Seconds to Time Object.js
Last active August 29, 2015 14:00
[JAVASCRIPT] - Convert Seconds to Time Object
function secondsToTime(secs)
{
var hours = Math.floor(secs / (60 * 60));
var divisor_for_minutes = secs % (60 * 60);
var minutes = Math.floor(divisor_for_minutes / 60);
var divisor_for_seconds = divisor_for_minutes % 60;
var seconds = Math.ceil(divisor_for_seconds);
@64lines
64lines / Conter Progresive and Regresive.js
Created April 18, 2014 03:57
[JQUERY] Conter Progresive and Regresive
/*
* This functions needs JQuery and Three DOM objects
* with id minutes, seconds and hours.
*/
function progresiveCounter() {
var seconds = 0;
var minutes = 0;
var hours = 0;
var strSeconds = "";
@64lines
64lines / WebView Execute Code.js
Created April 18, 2014 03:57
[CHROME API] - WebView Execute Code
function webViewExecuteCode() {
webview.executeScript({ code: "document.body.style.backgroundColor = 'red'" });
}
@64lines
64lines / Set Interval.js
Created April 18, 2014 03:58
[JAVASCRIPT] - Set Interval
setInterval(function() {
// Execute ever single second.
}, 1000);
@64lines
64lines / Set Timeout.js
Created April 18, 2014 03:58
[JAVASCRIPT] - Set Timeout
setTimeout(function() {
// Wait until 1 second to execute this.
}, 1000);
@64lines
64lines / Convert JSON to String.js
Created April 18, 2014 03:59
[JAVASCRIPT] - Convert JSON to String
JSON.stringify(jsonObject);
@64lines
64lines / Convert String to JSON.js
Created April 18, 2014 04:00
[JAVASCRIPT] - Convert String to JSON
JSON.parse(stringValue);
@64lines
64lines / Center div.css
Created April 18, 2014 04:06
[CSS] - Center DIV
#idOfTheDiv {
width: 400px; /* here you put the width that you need */
height: 200px; /* here you put the height that you need */
position:absolute;
left:50%;
top:50%;
margin-left:-200px; /* this number always to be the width divided two in negative */
margin-top:-100px; /* this number always to be the height divided two in negative */
}