Skip to content

Instantly share code, notes, and snippets.

View michalvalasek's full-sized avatar

Michal Valasek michalvalasek

View GitHub Profile
@michalvalasek
michalvalasek / minimal_modal_window.js
Created November 15, 2012 14:24
Minimal modal window using jQuery
$(function() {
/* Modal window script in 9 lines */
function mw_load(html) {
mw_mask = 'background:#333;height:100%;opacity:0.33;position:fixed;top:0;left:0;width:100%;z-index:1000;';
mw_win = 'background: white;border-radius: 5px;box-shadow: 0 1px 2px #666;left: 33%;padding: 2%;position: fixed;top: 23%;width: 33%;z-index: 1001;';
$('head').append('<style id="mw_style">#mw_mask{'+mw_mask+'}#mw_win{'+mw_win+'}</style>');
$('body').append('<div id="mw_mask"></div><div id="mw_win">'+html+'</div>');
$('#mw_mask,.mw_close').unbind('click').bind('click', function() {mw_close();});
}
function mw_close() {
@michalvalasek
michalvalasek / konvertor.sh
Created October 2, 2012 21:42
Converts a text file from windows-1250 encoding to utf-8
#!/bin/bash
if [ "$1" == "" ]
then
echo "usage: $0 <Input file>"
exit 0
fi
if ! [ -f $1 ]
then
@michalvalasek
michalvalasek / new_bulk.html.erb
Created August 1, 2012 13:50
merging problem
<%= breadcrumbs([@campaign.client_advertiser, @campaign, :creatives, :bulk]) %>
<div class = "page-header">
<h2><%= @campaign.name %>: Create Multiple Creatives</h2>
</div>
<%= form_for(@creative, :url => bulk_create_campaign_creatives_url(@campaign), :html => {:class => "form-horizontal"}) do |f| %>
<%= f.error_messages :class => "alert alert-error span10" %>
@michalvalasek
michalvalasek / PackagesUserDefault (OSX).sublime-keymap
Created May 25, 2012 14:05
ERB snippet + keybinding for Sublime Text 2
[
{
"keys": ["command+shift+."],
"command": "insert_snippet",
"args": {"name": "Packages/User/erb.sublime-snippet"}
}
]
@michalvalasek
michalvalasek / index.html
Created May 2, 2012 14:06
Skin Toggler prototype
<!DOCTYPE html>
<html lang="en">
<head>
<title>Skinner Toggler Test</title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="robots" content="all">
<link rel="stylesheet" href="">
module AsynchronousPush
module ClassMethods
def push_to_network(entity_network_id)
entity_network = self.find(entity_network_id)
if entity_network.remote_id
entity_network.update_remote
else
entity_network.build_remote
end
end
@michalvalasek
michalvalasek / gist:2122329
Created March 19, 2012 18:12
Arduino Lamer #2
const int LED = 13;
const int SENSOR = 4;
int val = 0;
void setup()
{
pinMode(LED, OUTPUT);
pinMode(SENSOR, INPUT);
}
@michalvalasek
michalvalasek / gist:2122156
Created March 19, 2012 18:08
Arduino Lamer #1
const int LED = 9;
int i = 0;
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
@michalvalasek
michalvalasek / about.md
Created August 11, 2011 13:32 — forked from sputnikus/about.md
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.