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
| class DefaultImage | |
| def initialize(width, height) | |
| @width = width | |
| @height = height | |
| end | |
| def create(options={}) | |
| name = options[:name] || "image_#{Time.now.to_i}" | |
| default_format = 'png' |
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
| curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d jsondata http://localhost:3000/api/path |
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
| inputs = %w[ | |
| CollectionSelectInput | |
| DateTimeInput | |
| FileInput | |
| GroupedCollectionSelectInput | |
| NumericInput | |
| PasswordInput | |
| RangeInput | |
| StringInput | |
| TextInput |
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
| // http://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery/18078705#18078705 | |
| var ajax = {}; | |
| ajax.xhr = function() { | |
| try { | |
| return new ActiveXObject('Msxml2.XMLHTTP') | |
| } catch (e1) { | |
| try { | |
| return new ActiveXObject('Microsoft.XMLHTTP') | |
| } catch (e2) { |
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 User settings | |
| { | |
| "font_size": 11, | |
| "ignored_packages": | |
| [ | |
| "Vintage" | |
| ], | |
| "tab_size": 2, | |
| "translate_tabs_to_spaces": true, |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| Sidekiq.logger.formatter = proc do |severity, timestamp, context, message| | |
| case severity | |
| when 'INFO' | |
| severity = severity.green | |
| when 'ERROR' | |
| severity = severity.red | |
| else 'WARN' | |
| severity = severity.yellow | |
| end |
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 | |
| mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql | |
| // restore | |
| mysql -u root -p[root_password] [database_name] < dumpfilename.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
| var data; | |
| data = { | |
| user: { | |
| email_address: "[email protected]", | |
| provider: "linkedin", | |
| uid: "1234567", | |
| info: { | |
| nickname: "jbloggs", | |
| name: "Joe Bloggs", |
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
| SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'TARGET_DB' AND pid <> pg_backend_pid(); |
OlderNewer