Skip to content

Instantly share code, notes, and snippets.

View yitsushi's full-sized avatar
🏳️‍⚧️

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
@yitsushi
yitsushi / Google+ DB.js
Created August 28, 2012 18:22
Google App Script for Google Form: get displayName from Google+ ID
/**
* Set a trigger:
* onFormSubmit -> getDisplayName
*
* Form: Google+ ID (must be the first column in the form)
* or you need to change `id = e.values[1];` line
* in getDisplayName function to the correct column number
*
* Author: Balazs Nadasdi
* <[email protected]>
@yitsushi
yitsushi / DIVrefresh.html
Created August 25, 2012 20:20 — forked from droid242/DIVrefresh
DIV refresh
<!DOCTYPE html>
<html lang="hu">
<head>
<title>DIV refresh page</title>
<meta charset="utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
// en jobban szeretem a jQuery format mint a jQuery-et
// mert igy kisebb az esely hogy osszeakad massal :)
@yitsushi
yitsushi / xmlmerge.rb
Created May 17, 2012 19:05
merge new file entries into the old translated strings.xml for android translators (doesn't override original files)
require 'rubygems'
require 'xmlsimple'
old_file = ARGV[0] rescue nil
new_file = ARGV[1] rescue nil
output = ARGV[2] rescue nil
if old_file.nil? or new_file.nil?
puts "#{$0} <old_string.xml> <new_string.xml> [output_string.xml]"
exit
-- Show current song
-- by Balazs Nadasdi
set the enabledNotification to {"iTunes Current Song"}
tell application "System Events"
set isGrowlRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
set isiTunesRunning to (count of (every process whose bundle identifier is "com.apple.iTunes")) > 0
end tell
@yitsushi
yitsushi / array_object_extend.php
Created July 5, 2011 23:00
How to extend the ArrayObject and create a custom array
<?php
class MyArray extends ArrayObject {
function __construct($array = array()){
parent::__construct($array, ArrayObject::ARRAY_AS_PROPS);
}
public function get_property_string($sep = ':') {
return implode($sep, $this->getArrayCopy());
}
@yitsushi
yitsushi / browsers.text
Created July 2, 2011 16:32
Memory usage of Browsers
Scripts:
--------
ps aux | grep -i firefox | awk '{sum += $4} END {print 4*1024 * (sum/100)}'
ps aux | grep -i safari | awk '{sum += $4} END {print 4*1024 * (sum/100)}'
ps aux | grep -i chrome | awk '{sum += $4} END {print 4*1024 * (sum/100)}'
Time-Table:
-----------
Name Mega
@yitsushi
yitsushi / virtualbox_with_ruby.rb
Created June 28, 2011 10:35
Get VirtualBox info with ruby...
require "rubygems"
require "virtualbox"
vms = VirtualBox::VM.all
vms.each do |vm|
puts <<EOI
#{vm.name}
#{"="*vm.name.length}
Memory: #{vm.memory_size} MB
@yitsushi
yitsushi / insert.php
Created June 19, 2011 21:37
mysql insert
<?php
DEFINE('MYSQL_LIMIT', 5000);
$datas = array(
array(1,2,3),
array(1,2,3),
array(1,2,3),
array(1,2,3),
array(1,2,3)
);
<?php
interface ILogin {
public function check_password(
$username,
$password,
$opts = array()
);
public function do_login(
$username,
$password,
@yitsushi
yitsushi / order_by_likes_count.php
Created May 8, 2011 22:25
How to order it ^_^ Just use mapReduce
<?php
require_once "init.php";
$map = new MongoCode("function() {
this.comments_count = this.comments.length;
if (this.likes) this.likes_count = this.likes.length;
else this.likes_count = 0;
emit(this, {count: 1});
}");