Skip to content

Instantly share code, notes, and snippets.

View fedmich's full-sized avatar
🏠
Working from home. open for job opportunity

Federico fedmich

🏠
Working from home. open for job opportunity
View GitHub Profile
@fedmich
fedmich / update_iframe.js
Created February 12, 2014 00:23
Update_iframe
$(document).ready(function () {
var oFra = $("#iframe_id");
$("#button3").click(function () {
oFra.attr("scrolling", "yes");
oFra.attr("src", oFra.attr("src"));
});
});

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@fedmich
fedmich / clip_thumb.php
Created March 12, 2012 05:26
Fed - CakePHP
<img src="<?= $this->Thumb->clip_thumb('ImageFilename','300x300'); ?>" alt="" />
@fedmich
fedmich / Expire headers.htaccess
Created March 19, 2012 06:28
HTaccess apache
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2692000 seconds"
ExpiresByType image/jpeg "access plus 2692000 seconds"
ExpiresByType image/png "access plus 2692000 seconds"
ExpiresByType image/gif "access plus 2692000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2692000 seconds"
ExpiresByType text/css "access plus 2692000 seconds"
ExpiresByType text/javascript "access plus 2692000 seconds"
@fedmich
fedmich / doc_append.js
Created April 9, 2012 09:01
Javascript Codes
function doc_append ( obj ){
if( document.getElementsByTagName("head").length > 0 ){
document.getElementsByTagName("head")[0].appendChild( obj );
}
else{
document.getElementsByTagName("body")[0].appendChild( obj );
}
}
var url_css = 'http://example.com/css/file.css';
@fedmich
fedmich / append_external.js
Created April 11, 2012 07:09
Javascript Codes (Bookmarklets)
javascript:(function(){document.body.appendChild(document.createElement('script')).src='http://example.com/js/bookmarklet.min.js?r='+(Math.random()*99999999);})();
@fedmich
fedmich / ai_autoselect.js
Created April 12, 2012 02:53
Javascript A.I.
/*
AI, Auto Select an item from select dropdown, based on url
* @author fedmich
* @version 1.0
*/
function ai_autoselect ( css_select , url ){
if( ! url ){ return; }
var obj_sel = $( css_select )
if(obj_sel.val()){
return true; //user already picked something, just skip
@fedmich
fedmich / hyperlink google search query
Created April 18, 2012 07:25
Google Docs, Spreadsheet
@fedmich
fedmich / post_query.py
Created April 20, 2012 07:50
Python codes
import httplib, urllib
params = urllib.urlencode({
'param': 'value',
'param2': 'value2'
})
headers = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"
@fedmich
fedmich / hide_other_elements.js
Created April 21, 2012 02:50
Javascript - Hide elements like iframe, embedded objects on the page
/*
Hides iframe from youtube, embedded objects
*/
function hide_other_elements(){
var iframes = document.getElementsByTagName('iframe');
jQuery(iframes).each(function(){
if( (this.src + '').match('http://www.youtube.com/embed/') ){
jQuery( this ).parent().addClass('hidden_elements');
}
});