Skip to content

Instantly share code, notes, and snippets.

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

Sebastian Ortiz dsebao

🏠
Working from home
View GitHub Profile
@dsebao
dsebao / script.js
Created November 18, 2016 14:51
Check the element whas been scrolled into the view
function isScrolledIntoView(elem) {
var $window = $(window);
return elem.offset().top + elem.outerHeight() >= $window.scrollTop() && elem.offset().top <= $window.scrollTop() + $window.height();
}
@dsebao
dsebao / text.txt
Created November 9, 2016 15:46
Set bootstrap 3 on sketch
Bootstrap 3 grid in Sketch 3:
medium: 1000px - 12col - 30px - 53px
large: 1170px - 12col - 30px - 68px
Both: gutter on outside enabled
@dsebao
dsebao / terminal.sh
Created November 8, 2016 03:39
Mount NFTS disk macOs
sudo umount /Volumes/UNTITLED
sudo mount -t ntfs -o rw,auto,nobrowse /dev/disk3s1 ~/ntfs-volume
@dsebao
dsebao / index.html
Created October 24, 2016 19:08
Simple CSS Hamburguer icon
<a href="" id="iconmenu"></a>
@dsebao
dsebao / functions.php
Created September 21, 2016 02:09
Get youtube id from url
function youtube_id_from_url($url) {
$pattern =
'%^# Match any youtube URL
(?:https?://)? # Optional scheme. Either http or https
(?:www\.)? # Optional www subdomain
(?: # Group host alternatives
youtu\.be/ # Either youtu.be,
| youtube\.com # or youtube.com
(?: # Group path alternatives
/embed/ # Either /embed/
@dsebao
dsebao / script.js
Created September 8, 2016 17:36
Timer Javscript/Jquery
setTimeout(function(){
//stuff
}, 2000);
@dsebao
dsebao / functions.php
Last active July 21, 2017 14:27
Test Wordpress locally with ngrok changin absolute url
//Remove absolute paths to relative paths for using ngrok urls
add_action('template_redirect', 'odt_autoload');
function odt_autoload(){
if(!isset($_GET['odt_autoload'])){
$site_url = site_url().'/';
echo str_replace($site_url, 'http://' . $_SERVER['HTTP_HOST'] . wp_make_link_relative($site_url), file_get_contents(add_query_arg('odt_autoload', 1, 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'])));
exit;
}
}
@dsebao
dsebao / script.js
Created August 9, 2016 18:20
Open popup with jQuery
$('.openpopup').click(function(){
var url = $(this).attr('href');
window.open(url, this.target, 'width=320,height=450,left=150,top=100');
return false;
});
@dsebao
dsebao / getcitynamebycoord.php
Created May 20, 2016 04:36
Get City Name by google api 3 coordinates
function get_api ($lat, $long) {
$get_API = "http://maps.googleapis.com/maps/api/geocode/json?latlng=";
$get_API .= round($lat,2).",";
$get_API .= round($long,2);
$jsonfile = file_get_contents($get_API.'&sensor=false');
$jsonarray = json_decode($jsonfile);
if (isset($jsonarray->results[1]->address_components[1]->long_name)) {
return($jsonarray->results[1]->address_components[1]->long_name);