This file contains 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
Dim conn | |
Dim objRS | |
Dim cmd | |
Set conn = Server.CreateObject("ADODB.Connection") | |
Set objRS = Server.CreateObject("ADODB.Recordset") | |
Set cmd = Server.CreateObject("ADODB.Command") | |
conn.Open "Provider=SQLOLEDB;Data Source=192.168.x.x;Initial Catalog=xxxxx;User Id=x;Password=xxxxxxxxxxxxxx" |
This file contains 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
# Find an object in the console | |
User.where("query = ?", condition) | |
# Find an attribute in the model (if it is an array) | |
u.first.attribute | |
# Destroy an object that has association. Better than delete. | |
object.destroy | |
# Pretty output |
This file contains 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
SELECT * FROM `table_name` | |
WHERE `record_name` IN ( | |
SELECT `record_name` | |
FROM `table_name` | |
GROUP BY `record_name` | |
HAVING count(`record_name`) > 1 | |
) | |
ORDER BY `record_name` |
This file contains 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
require 'hirb' | |
Hirb.enable | |
Hirb::View.enable |
This file contains 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
1. Go to start of block. | |
2. `Ctrl+V`, then traverse down the block. Only the beginning of the line will be selected. | |
3. `Shift+I` to insert text at the beginning of the marker. | |
4. Press the hash/pound key (`#`), then escape (`Ctrl+[`). Your block of code will magically be commented. |
This file contains 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
YAML::ENGINE.yamler='syck' |
This file contains 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
PostgreSQL | |
---------- | |
After logging in to the PSQL console: | |
db=> \o /path/to/where/you/want/the/file/saved | |
db=> the sql query | |
db=> | |
Output is saved, though there is no feedback from the console. |
This file contains 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
SELECT SUM(A.COUNT) | |
FROM | |
(SELECT COUNT(*) AS count FROM table1 | |
union all | |
SELECT COUNT(*) AS count FROM table2) A |
This file contains 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
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
.qrcode widget { | |
display: none | |
} | |
@media screen and (min-width: 0px) and (max-width: 400px) { | |
#my-content { display: block; } /* show it on small screens */ | |
} |
This file contains 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
# Backup | |
pg_dump -U username database_to_backup -f /path/to/backup/file | |
#Restore | |
psql -U username -d database_to_restore -f /path/to/backup/file |
OlderNewer