Skip to content

Instantly share code, notes, and snippets.

View andreiglingeanu's full-sized avatar

Andrei Glingeanu andreiglingeanu

View GitHub Profile
/*##########################################################################################
Prepend <span> in Flickr Widget
##########################################################################################*/
jQuery(document).ready(function($){
$('.ewd-banner-fixed').closest('.widget.widget_text').addClass('affix-banner');
var addFixed = false;
$(window).scroll(function (e) {
jQuery('table.fullWidth > tbody > tr') // selectăm rîndurile din tabel
.slice(1) // primul nu ne interesează, în el se conține titlul la tabel
.filter(function(){ // filtrăm setul primit de rînduri ca să rămînem doar cu rîndurile ce nu au mesaje noi
// imaginea roșie se numește unlockednew.gif, cea albastră - unlocked.gif
// se poate și așa: return jQuery(this).find('img')[0].src.match(/unlocked.gif$/));
return ! (jQuery(this).find('img')[0].src.match(/new.gif$/));
}).remove(); // ștergem rîndurile ce nu au mesaje noi
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ -g ""'
@import url('http://fonts.googleapis.com/css?family=[h1_font_family]');
body.ct-boxed {
background-color: [boxed_container_bg] !important;
}
@media (min-width: [site_width]px) {
body.ct-boxed .ct-header,
body.ct-boxed .ct-content-wrapper {
width: [site_width]px !important;
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCW5udpYbZxAp4DqJsB6Od9uxxS1zClw+bBkYM/1e92sQmhjcdMpTgeNkAaE5DGrCdHPG/RiVX6fmHdQG3Q5usMqxXCnJbKJNHzKMqEV+tOV8nL5BObKN4xrScg8n3kD7QbQOlhZG0fpR25u/S+XSP9QGv2oekoXG9tMp1GMrf8cXucSkP6mkoucNfowHvAGYibKff+y5iq92n+Hk/ncC9wsNIeAll2GXclxZfymZL053euk8161K+zNGbkHJS11rAG7csOqpnEPPiDO/Z25dwmnwAZBW9RavPj/3DEOxXYxhPjj16TRCEM8Kj59CWnNQdu4FaqWbh+E6cMyDBfwWtp andrei@apples-MacBook-Air.local
module ApplicationHelper
# a helper to get a data uri for an image asset
# e.g. <img src="<%= asset_data_uri('facebook.png') %>" />
def asset_data_uri(path)
asset = asset_paths.asset_for path, nil
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "")
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"
end
end

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@andreiglingeanu
andreiglingeanu / events.js
Last active December 13, 2015 20:08
pure javascript event utility - a mini-framework for less use of events in js.
var eventUtility = {
addEvent : (function() {
if (typeof addEventListener !== "undefined") {
return function(obj, evt, fn) {
obj.addEventListener(evt, fn, false);
};
} else {
return function(obj, evt, fn) {
obj.attachEvent("on" + evt, fn);
};
@andreiglingeanu
andreiglingeanu / class.js
Created February 17, 2013 16:14
javascript class utility
function addClass(el, cls) {
var c = el.className.split(' ');
for (var i=0; i<c.length; i++) {
if (c[i] == cls) return;
}
c.push(cls);
el.className = c.join(' ');
}
function removeClass(el, cls) {
@andreiglingeanu
andreiglingeanu / getComputedStyle.js
Last active December 13, 2015 20:48
getComputedStyle for IE
function getIEComputedStyle(elem, prop) {
var value = elem.currentStyle[prop] || 0
// we use 'left' property as a place holder so backup values
var leftCopy = elem.style.left
var runtimeLeftCopy = elem.runtimeStyle.left
// assign to runtimeStyle and get pixel value
elem.runtimeStyle.left = elem.currentStyle.left
elem.style.left = (prop === "fontSize") ? "1em" : value