Skip to content

Instantly share code, notes, and snippets.

View Spoygg's full-sized avatar

Ivan Ivanić Spoygg

View GitHub Profile
@Spoygg
Spoygg / symfony1.4-show-all-form-errors.php
Created August 3, 2012 09:05
Symfony 1.4 get all form errors.
<ul class="error_list">
<?php foreach( $form->getGlobalErrors() as $name => $error ) : ?>
<li><?php echo $name ?> : <?php echo $error ?></li>
<?php endforeach ?>
<?php $errors = $form->getErrorSchema()->getErrors() ?>
<?php if ( count($errors) > 0 ) : ?>
<?php foreach( $errors as $name => $error ) : ?>
<li><?php echo $name ?> : <?php echo $error ?></li>
<?php endforeach ?>
<?php endif ?>
function wmode() {
// For each iFrame
$('iframe').each(function () {
// Store some variables
var $this = $(this),
src = $this.attr('src'),
query;
@Spoygg
Spoygg / slow-connection.bash
Created September 5, 2012 07:34
Simulaitng slow connection.
# Add delay of 1000 millis to every request
sudo tc qdisc add dev lo root handle 1:0 netem delay 1000msec
# Remove delay
sudo tc qdisc del dev lo root
foreach($serviceTypes as $serviceType) {
$clean = str_replace(',', '', $serviceType->getName());
$options[$clean] = $this->getCourierName($serviceType->getCourierId()) . ' - ' . $serviceType->getName();
}
$sql = "select qst.system_name as system_name, qst.question as question, ans.answer as answer from " . EVENTS_ANSWER_TABLE . " ans inner join " . EVENTS_QUESTION_TABLE . " qst on ans.question_id = qst.id where qst.system_name = 'country' and ans.attendee_id = " . $attendee_id;
$questions = $wpdb->get_results($sql, ARRAY_A);
if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->question != NULL) {
foreach ($questions as $q) {
$country = $q['answer'];
}
}
$country = '';
$sql = "select qst.system_name as system_name, qst.question as question, ans.answer as answer from " . EVENTS_ANSWER_TABLE . " ans inner join " . EVENTS_QUESTION_TABLE . " qst on ans.question_id = qst.id where qst.system_name = 'country' and ans.attendee_id = " . $attendee_id;
$questions = $wpdb->get_results($sql, ARRAY_A);
if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->question != NULL) {
foreach ($questions as $q) {
$country = $q['answer'];
}
}
@Spoygg
Spoygg / README.md
Last active December 10, 2015 06:08 — forked from anonymous/deviant-art-bookmarklet.js
Simple bookmarklet to activate two keyboard shortcuts on http://my.deviantart.com/messages/#view=deviations single deviation view. First is to 'a' to "Add to Favorites", second is 'k' to remove from messages. (kill is mnemonic for 'k'). Instructions: add bookmark with contents of this file. When on dA single deviation view click on bookmark.

Unfortunately below link does not work.

Drag on bookmarks toolbar

spoygg@Yggdrasill ~/S/unwrap> vagrant up
[default] Box debian64 was not found. Fetching box from specified URL...
[vagrant] Downloading with Vagrant::Downloaders::HTTP...
[vagrant] Downloading box: https://dl.dropbox.com/u/366736/Vagrant%20boxes/debian64.box
[vagrant] Extracting box...
[vagrant] Verifying box...
[vagrant] Cleaning up downloaded box...
[default] Importing base box 'debian64'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
Generated at Tue Mar 26 10:27:03 +0000 2013
Chef::Exceptions::CookbookNotFound: Cookbook timezone-ii not found. If you're loading timezone-ii from another cookbook, make sure you configure the dependency in your metadata
/usr/lib/ruby/gems/1.8/gems/chef-11.4.0/bin/../lib/chef/cookbook/cookbook_collection.rb:38:in `initialize'
/usr/lib/ruby/gems/1.8/gems/ohai-6.16.0/lib/ohai/mash.rb:77:in `call'
/usr/lib/ruby/gems/1.8/gems/ohai-6.16.0/lib/ohai/mash.rb:77:in `default'
/usr/lib/ruby/gems/1.8/gems/ohai-6.16.0/lib/ohai/mash.rb:77:in `default'
/usr/lib/ruby/gems/1.8/gems/chef-11.4.0/bin/../lib/chef/run_context/cookbook_compiler.rb:265:in `[]'
/usr/lib/ruby/gems/1.8/gems/chef-11.4.0/bin/../lib/chef/run_context/cookbook_compiler.rb:265:in `each_cookbook_dep'
/usr/lib/ruby/gems/1.8/gems/chef-11.4.0/bin/../lib/chef/run_context/cookbook_compiler.rb:243:in `add_cookbook_with_deps'
/usr/lib/ruby/gems/1.8/gems/chef-11.4.0/bin/../lib/chef/run_context/cookbook_compiler.rb:87:in `cookbook_order'
vagrant@unwrap:/source$ composer install
Loading composer repositories with package information
Installing dependencies from lock file
Generating autoload files
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "parameters.yml" from "/source/app/config/config.yml".