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
| def fn(pattrn, table, text, _range): | |
| x = 0 | |
| if _range[1] <= len(text): | |
| x = 1 | |
| for i in range(_range[0], _range[1]): | |
| if text[_range[1] - x] != pattrn[len(pattrn) - x]: | |
| _ch = text[_range[1] - x] | |
| r = [x for x in table if x[1] == _ch] | |
| _shift = len(pattrn) if not r else r[0][0] | |
| _shift = _range[1] + (_shift + 1 if _shift < 1 else _shift) |
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
| server { | |
| listen 80; | |
| server_name example.com; | |
| return 301 http://www.example.com$request_uri; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.example.com; | |
| } |
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
| <VirtualHost *:80> | |
| ServerName www.mydomain.com | |
| DocumentRoot /var/www | |
| ProxyRequests Off | |
| ProxyPass /media ! | |
| ProxyPass /static ! | |
| ProxyPass / http://127.0.0.1:8000/ |
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
| ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl |
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
| 100% — FF | |
| 95% — F2 | |
| 90% — E6 | |
| 85% — D9 | |
| 80% — CC | |
| 75% — BF | |
| 70% — B3 | |
| 65% — A6 | |
| 60% — 99 | |
| 55% — 8C |
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
| mysql -uroot -p --default-character-set=utf8 database < dump.sql |
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
| public void CopyValues<T>(T target, T source) | |
| { | |
| Type t = typeof(T); | |
| var properties = t.GetProperties().Where(prop => prop.CanRead && prop.CanWrite); | |
| foreach (var prop in properties) | |
| { | |
| var value = prop.GetValue(source, null); | |
| if (value != null) |
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
| new android.os.Handler().postDelayed( | |
| new Runnable() { | |
| public void run() { | |
| Log.i("tag", "This'll run 300 milliseconds later"); | |
| } | |
| }, 300); |
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
| AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => '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
| ps -ef | awk '/[k]eyword/{print $2}' |