This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'nokogiri' | |
def walker node, indent = '' | |
if node.name == 'text' | |
indent + '"' + node.content.strip.gsub( '"', '\"' ) + '"' | |
else | |
attrs = '[' + node.attributes.map{ |el| '{' + ( el[1].name.include?( '-' ) ? "'#{ el[1].name }'" : el[1].name ) + ', "' + el[1].value + '"}' }.join( ', ' ) + ']' | |
children_for_print = node.children.reject{ |child| child.name == 'text' and child.content.strip.empty? } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME=$1; | |
DN=$(wmctrl -d | grep \* | sed 's/^\([[:digit:]]*\).*$/\1/g'); | |
WID=$(wmctrl -l -p | grep ".* $DN .*" | grep $NAME | sed "s/^\([[:graph:]]*\)\ *$DN\ *[[:graph:]]*\ *.*$/\1/g"); | |
wmctrl -i -a $WID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ma = document.createElement('div'); | |
ma.setAttribute('style', 'font-size: 8px; width: 255px; right: 90px; opacity: 0.8; z-index: 700; position: absolute; background: white;'); | |
document.querySelector('div.pv_fixed').appendChild(ma); | |
ajax.post('al_photos.php', { | |
act: 'a_move_to_album_box', | |
photo_id: cur.pvCurPhoto.id | |
}, { | |
onDone: function(title, html, js, data) { | |
var el = document.createElement('div'); | |
el.innerHTML = html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIR=dirname; zip -rq ~/backup/$DIR`date +%Y%m%d-%H%M%S`.zip $DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = STDIN.read | |
data = data.scan( /\d+/ ).map{ |is| is.to_i } | |
N = data.shift | |
K = data.shift | |
cables = data.clone | |
max = cables.max | |
max2 = 2 ** (Math::log(max+1) / Math::log(2)).ceil | |
l = step = max2 / 2 | |
max_l = 0 | |
while step > 0 do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
del = @_element.find 'button#delete' | |
del2 = @_element.find 'button#delete_confirmation' | |
del2.hide() | |
delay1 = null | |
delay2 = null | |
effect = [ 'slide', direction: 'left', 500 ] | |
hide_del2 = -> del2.hide.apply del2, effect | |
delay_args = [ hide_del2, 4000 ] | |
del.on 'click mouseenter', ( event ) => | |
del2.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inpt = $ 'input.date' | |
inpt.on 'keypress', ( event ) => | |
key = event.key | |
val = inpt.val() | |
unless /^[0-9\-]$/.test( key ) or event.ctrlKey or event.keyCode > 0 | |
event.preventDefault() | |
if /^[0-9\-]$/.test( key ) | |
if /^[0-9]{3}$/.test( val ) or /^[0-9]{2,4}\-[0-9]{1}$/.test( val ) | |
inpt.val val + key + '-' | |
event.preventDefault() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"font_size": 9, | |
"tab_size": 2, | |
"detect_indentation": false, | |
"draw_white_space": "all" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'find' | |
paths = [] | |
Find.find('.') do |path| | |
next unless path =~ /.*\.jar$/ | |
next if path =~ /javadoc\.jar$/ or path =~ /sources\.jar$/ | |
next if path.include? 'test' | |
paths << path | |
end | |
paths.each do | path | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ToDo on handlers, many id & classes, more smart names? | |
#oop?, https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes, shortcuts? | |
#!? html -> vdom | |
#? $class: , $node$class: , $$id ? | |
#? postcss ? | |
#? class names like BEM? | |
window.t = '#ss': | |
data: ff: 2, ee: 4 | |
img: cls: 'asdf', src: 'https://elixir-lang.org/images/logo/logo.png', width: 100 |
OlderNewer