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 index | |
| @shippings = Shipping.active.includes(:zones, :tiers).all | |
| respond_to do |format| | |
| format.html # index.html.erb | |
| format.json { render json: @shippings } | |
| end | |
| 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
| @WebMethod(operationName = "getTwitPic") | |
| public String getTwitPic(@WebParam(name = "username") String username) { | |
| String userImage = ""; | |
| String site_url = "http://www.twitter.com/" + username; | |
| try{ | |
| Connection.Response twitter_response = Jsoup.connect(site_url).timeout(50000).execute(); | |
| Document doc = twitter_response.parse(); | |
| Elements img_element = doc.select("img.ProfileAvatar-image"); | |
| if(!img_element.isEmpty()){ |
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
| <?php | |
| ini_set("soap.wsdl_cache_enable",0); | |
| $values=array( | |
| "username" => "glcebru" | |
| ); | |
| $wsdl_url = "http://ebru:8080/WebServisOdevi/WebServis?wsdl"; | |
| $client = new SoapClient($wsdl_url); |
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
| @WebMethod(operationName = "getInstaPic") | |
| public String getInstaPic(@WebParam(name = "username") String username) { | |
| String userImage = ""; | |
| String site_url = "http://www.instagram.com/" + username; | |
| try{ | |
| Connection.Response insta_response = Jsoup.connect(site_url).timeout(50000).execute(); | |
| Document insta_doc = insta_response.parse(); | |
| Elements meta_im = insta_doc.select("meta[property=og:image]"); | |
| if(!meta_im.isEmpty()){ |
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 ExampleJob < ActiveJob::Base | |
| # Set the Queue as Default | |
| queue_as :default | |
| def perform(*args) | |
| # Perform Job | |
| end | |
| 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
| class ExampleJob < ActiveJob::Base | |
| rescue_from(ErrorLoadingSite) do | |
| retry_job wait: 5.minutes, queue: :low_priority | |
| end | |
| def perform(*args) | |
| # Perform Job | |
| end | |
| 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
| sudo dpkg -i <package_name>.deb |
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
| <FilePond | |
| onupdatefiles={(fileItems) => { | |
| this.setState({ | |
| files: fileItems.map(fileItem => fileItem.file) | |
| }); | |
| }} | |
| onDrop={this.handleUploadImages}/> |
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
| handleScanner = () => { | |
| const formData = new FormData(); | |
| formData.append("file", this.state.files[0]); | |
| formData.append("tags", 'text_detection'); | |
| formData.append("upload_preset", {UPLOAD_PRESENT_ID}); | |
| formData.append("api_key", API_KEY); | |
| formData.append("timestamp", (Date.now() / 1000) | 0); | |
| axios.post( | |
| "https://api.cloudinary.com/v1_1/{YOUR_USERNAME}/image/upload"", |
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
| const formatCurrency = function( | |
| currencySymbol, | |
| decimalSeparator ) { | |
| return function( value ) { | |
| const wholePart = Math.trunc( value / 100 ); | |
| let fractionalPart = value % 100; | |
| if ( fractionalPart < 10 ) { | |
| fractionalPart = '0' + fractionalPart; | |
| } | |
| return `${currencySymbol}${wholePart}${decimalSeparator}${fractionalPart}`; |