Skip to content

Instantly share code, notes, and snippets.

View lalala's full-sized avatar

Per Andersen lalala

  • Stockholm, Sweden
View GitHub Profile
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/rvm/gems/ruby-1.9.2-head@cochimetl/gems/passenger-3.0.7;
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-head@cochimetl/ruby;
#include mime.types;
sudo /opt/nginx/sbin/nginx -s reload
nginx: [emerg] getgrnam("deploy") failed in /opt/nginx/conf/nginx.conf:2
----
cat /opt/nginx/conf/nginx.conf
user deploy;
worker_processes 1;
Started POST "/users/2/goals/1/edit/update_task_order" for 127.0.0.1 at 2011-10-19 11:28:27 +0200
Processing by GoalsController#update_task_order as */*
Parameters: {"tasks_order"=>"1,3,2,4", "id"=>"2", "goal_id"=>"1"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
Goal Load (0.1ms) SELECT "goals".* FROM "goals" WHERE "goals"."id" = 1 LIMIT 1
Task Load (0.2ms) SELECT "tasks".* FROM "tasks" WHERE "tasks"."goal_id" IN (1) ORDER BY position
SQL (328.6ms) UPDATE "tasks" SET position = (position - 1) WHERE ("tasks"."goal_id" = 1 AND position > 0)
(0.4ms) UPDATE "tasks" SET "position" = NULL, "updated_at" = '2011-10-19 09:28:27.773077' WHERE "tasks"."id" = 1
SQL (505.3ms) UPDATE "tasks" SET position = (position + 1) WHERE ("tasks"."goal_id" = 1 AND position >= 0)
(0.1ms) UPDATE "tasks" SET "position" = 0, "updated_at" = '2011-10-19 09:28:28.643210' WHERE "tasks"."id" = 1
[per@pollux Achievable]$ rake db:migrate
/home/per/.rvm/gems/ruby-1.9.2-head@achievable/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
rake aborted!
Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
------------------------------------------
Gemfile
resources :users do
member do
resources :goals
end
end
=====================================================
this gives
=====================================================
# What I want
$( "#sortable1, #sortable2" ).sortable({
connectWith: ".connectedSortable"
}).disableSelection();
# What I do
$('#current_goals, #future_goals').sortable ({
<form id="new_task" class="new_task" method="post" data-remote="true" action="/tasks" accept-charset="UTF-8" style="display: none;">
<div style="margin:0;padding:0;display:inline">
<input id="task_goal_id" type="hidden" value="2" name="task[goal_id]">
<input id="task_description" type="text" size="30" name="task[description]">
<input type="submit" value="Submit" name="commit">
</form>
# doesnt do much
.
.
.
char *printenv[] = { "printenv", NULL };
char *sort[] = { "sort", NULL };
char *less[] = { "less", NULL };
unsigned int *pro[3] = { &printenv, &sort, &less };
.
nextp :: Integer -> Integer -> Integer -> Integer -> [Integer]
nextp r a b m =
r1 : (nextp r1 a b m)
where
r1 = mod (a*r+b) m
metapung :: (Integer -> Integer) -> Integer -> [Integer]
metapung f seed =
n1 : (metapung f n1)
where
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int main() {
char** s = NULL;
char delim[] = " ";
char* tok = NULL;