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
**** | |
gpg ( configure your gpg settings ) | |
curl -sSL https://rvm.io/mpapis.asc | sudo gpg --import - | |
curl -L https://get.rvm.io | sudo bash -s stable --rails | |
rvm requirements, which ruby, rails -v ( test RVM, Ruby and Rails ) | |
*** |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import urllib2 | |
from base64 import b64encode | |
from BeautifulSoup import BeautifulStoneSoup | |
Help = """A tool for fetch flvxz.com video URL parse result. |
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
@echo off | |
SET CMDER_ROOT=%~dp0 | |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Cmder" /ve /d "Cmder Here" /f | |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Cmder" /v "Icon" /d "\"%CMDER_ROOT%cmder.exe\"" /f | |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Cmder" /v "Extended" /f | |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Cmder\command" /ve /d "\"%CMDER_ROOT%cmder.exe\" \"%%V\"" /f | |
pause |
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
I've been doing software development with OO for over 20 years now, and I can tell you that looking at other peoples code is more often than not going to teach you how to do procedural programming in an object oriented language. | |
What I would recommend is to use the following techniques, which if applied liberally, will force you to use OO techniques, even though you may not yet be aware of them. | |
Do not copy and paste code - ever. | |
Create classes that represent the things you talk about when talking about the functionality - for example, an order entry system will have Orders, Customers, Accounts, OrderItems, InventoryItems, etc. | |
When creating these classes, do NOT code any public set and get methods to access the class data members. | |
Add methods to these domain model classes that perform the work on the object in question. Order.invoice(), account.close(), InventoryItem.decrement(). The lack of public get methods will show you the correct location for the code (where the data is - in the app |
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
If you want to permanently remove the recent file list from totem, edit /usr/share/totem/totem.ui as root and change to following line: | |
<separator name="recent-separator"/> | |
<placeholder name="recent-placeholder"/> | |
into | |
<!--<separator name="recent-separator"/> | |
<placeholder name="recent-placeho |
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
Unfortunately Inwdr's answer breaks when there are multiple subclasses. | |
Here is a correct inheritable Singleton base class. | |
class Singleton | |
{ | |
private static $instances = array(); | |
protected function __construct() {} |
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
"#" is an argument used by Paperclip to know whether or not you expect the pic to be cropped. Using "100x100#" will scale and crop the picture exactly to that size. %@!<> are arguments in the Geometry String used by ImageMagick. One can use the following ImageMagick geometry strings for resizing images: | |
Ignore Aspect Ratio ('!') | |
Only Shrink Larger ('>') | |
Only Enlarge Smaller ('<') | |
Fill Given Area ('^') | |
Percentage Resize ('%') | |
Pixel Count Limit ('@') |
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
UPDATE for rails 3.2.12: | |
I just checked the source and the dependencies are like this now: | |
db:create creates the database for the current env | |
db:create:all creates the databases for all envs | |
db:drop drops the database for the current env | |
db:drop:all drops the databases for all envs | |
db:migrate runs migrations for the current env that have not run yet | |
db:migrate:up runs one specific migration |
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
When on your model has :confirmable option this mean the object user should be confirm first. You can do two ways to save user. | |
a. first is skip confirmation: | |
newuser = User.new({ | |
email: 'superadmin1@testing.com', | |
password: 'password', |
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
Backup Semua Database | |
Ada beberapa cara yang bisa dilakukan untuk melakukan backup database di MySQL. Berikut adalah artikel mengenai penggunaan MySQLDump. | |
Menggunakan MYSQLDUMP | |
mysqldump adalah utilitas client yang datang bersama distribusi MySQL. Aplikasi ini akan menghasilkan script SQL di console, sehingga bisa didump ke file melalui IO pipe. | |
Berikut adalah contoh-contoh penggunaan mysqldump untuk backup database : | |
Backup semua database - struktur dan data | |
mysqldump -uusername -ppassword -A |
NewerOlder