This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE test | |
| ( | |
| id INTEGER, | |
| parent INTEGER | |
| ); | |
| INSERT INTO test (id, parent) VALUES | |
| (1, NULL), | |
| (2, 1), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Blog.Repo.Migrations.CreatePost do | |
| use Ecto.Migration | |
| def up do | |
| create table(:posts, primary_key: false) do | |
| add :id, :uuid, primary_key: true | |
| add :title, :string | |
| add :body, :text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### | |
| TEXT Manipulation | |
| #### | |
| di' " Delete inside '' | |
| di" | |
| di[ | |
| di( | |
| di{ | |
| cit " Change inside tag. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foo=[nil, -3, 100, 4, 6, nil, 4, nil, 23] | |
| foo.sort{|a,b|( a and b ) ? a <=> b : ( a ? -1 : 1 ) } | |
| RESULT=> [-3, 4, 4, 6, 23, 100, nil, nil, nil] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| amit@rb:~$ psql -U postgres | |
| psql (9.0.3) | |
| Type "help" for help. | |
| postgres=# update pg_database set datallowconn = TRUE where datname = 'template0'; | |
| UPDATE 1 | |
| postgres=# \c template0 | |
| You are now connected to database "template0". | |
| template0=# update pg_database set datistemplate = FALSE where datname = 'template1'; | |
| UPDATE 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # As root user | |
| sudo su | |
| # Update the OS | |
| apt-get update -y | |
| apt-get dist-upgrade -y | |
| apt-get upgrade -y | |
| # Setup Hostname & TimeZone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sublime Text 2 - Useful Shortcuts (Mac OS X) | |
| ============================================ | |
| General | |
| ------- | |
| ---------- ------------------------------------- | |
| **⌘T** go to file | |
| **⌘⌃P** go to project | |
| **⌘R** go to methods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function(){ | |
| var tracker_arr = new Array(); | |
| $(window).bind('mousemove',function(e){ | |
| var tracker_obj = {}; | |
| tracker_obj['x'] = e.pageX; | |
| tracker_obj['y'] = e.pageY; | |
| tracker_arr.push(tracker_obj); | |
| }); | |
| $("#show").click(function(e){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var skeleton = function(){ | |
| // private variables ******* | |
| var x; | |
| // private functions | |
| // initialization ******* | |
| ( function init () { | |
| // only call private functions or variables! | |
| } ) (); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*URl Parsing Function*/ | |
| function parseUri(str) { | |
| var o = parseUri.options, | |
| m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), | |
| uri = {}, | |
| i = 14; | |
| while (i--) uri[o.key[i]] = m[i] || ""; | |
| uri[o.q.name] = {}; |