Skip to content

Instantly share code, notes, and snippets.

View zirosas's full-sized avatar

Jiro Sasamoto zirosas

View GitHub Profile
@zirosas
zirosas / dump HTTP headers
Created April 17, 2015 01:58
dump HTTP headers
<table border="1">
<% for header in request.env.select {|k,v| k.match("^HTTP.*")} %>
<tr>
<td><%=header[0].split('_',2)[1]%></td><td><%=header[1]%></td>
</tr>
<% end %>
</table>
To get all the elements starting with "jander" you should use:
$("[id^=jander]")
To get those that end with "jander"
$("[id$=jander]")
<ExhibitorList BoothID="164991">
<BoothNumber>N1849</BoothNumber>
<CompanyID>407</CompanyID>
<CompanyNumber>166212</CompanyNumber>
</ExhibitorList>
SoapResponse = xmlParse(httpResponse.fileContent);
ResponseNodes = xmlSearch(SoapResponse, "//*[ local-name() = 'ExhibitorList' ]");
for (i = 1; i lte arrayLen(ResponseNodes); i++) {
BoothNumber = ResponseNodes[i].BoothNumber;
var allClients = [];
io.sockets.on('connection', function(socket) {
allClients.push(socket);
socket.on('disconnect', function() {
console.log('Got disconnect!');
var i = allClients.indexOf(socket);
delete allClients[i];
});
gg gg
"" ""
,gg, ,gg gg gg,gggg, gg ,ggggg,
""8b,dP" 88 I8P" "Yb 88 dP" "Y8ggg
,88" 88 I8' ,8i 88 i8' ,8I
,dP"Y8, _,88,_,I8 _ ,d8' d8b _,88,_,d8, ,d8'
dP" "Y888P""Y8PI8 YY88888P Y8P 8P""Y8P"Y8888P"
I8
I8 wildcard DNS for everyone
""
$(document).ready(function(){
$("#myForm").validate({
rules: {
myDropDown:{
required: function (element) {
if($("#myCheckbox").is(':checked'))
{
var e = document.getElementById("myDropDown");
if(e.options[e.selectedIndex].value=="")
{
@zirosas
zirosas / Set DiffMerge as default merge tool in OS X
Last active January 13, 2016 16:21
Set DiffMerge as default merge tool in OS X From https://coderwall.com/p/3wuuda
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"
git config --global mergetool.diffmerge.trustExitCode true
ln -s /Applications/DiffMerge.app/Contents/Resources/diffmerge.sh /usr/local/bin/diffmerge
git config --global mergetool.keepBackup false
@zirosas
zirosas / json2table.js
Created April 21, 2014 22:20
jQuery : Create table row from JSON
var row = $("<tr></tr>");
$.each(data, function(key, val) {
$('<td>'+val+'</td>').appendTo(row);
});
$('#current_logged_in_users').append(row);
@zirosas
zirosas / new_gist_file.py
Created April 4, 2014 06:33
From http://tacamy.hatenablog.com/entry/2013/05/03/050329 ブラウザのアドレスバーに http://localhost:8888/{ファイル名} と入力して表示確認
$ python -m SimpleHTTPServer 8888
$( document.body ).on( 'click', '.dropdown-menu li', function( event ) {
var $target = $( event.currentTarget );
$target.closest( '.btn-group' )
.find( '[data-bind="label"]' ).text( $target.text() )
.end()
.children( '.dropdown-toggle' ).dropdown( 'toggle' );
return false;