# Decide how to define a method at runtime
class C
end
C.class_eval do
define_method :my_method do
'a dynamic method'
end
๐
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
0x636c48edbedd078cd9e196dc6c2154c7f82e73b0 |
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
package main | |
import "fmt" | |
func main() { | |
// Declare a variable of type int | |
var age int | |
// Get the user's age | |
fmt.Println("Enter your age:") |
I've some problem when setup project with:
- Rails 4.2.10
- Ruby 2.5.3
- Postgresql 13
My steps:
Install Homebrew
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
# https://www.geeksforgeeks.org/program-distance-two-points-earth/ | |
earthRadius = 6371 # km | |
d_lat = (origin[:lat] - destination[:lat]) / 180.0 * Math::PI | |
d_lng = (origin[:lng] - destination[:lng]) / 180.0 * Math::PI | |
sin_lat = Math.sin(d_lat / 2) | |
sin_lng = Math.sin(d_lng / 2) | |
rad_lat1 = origin[:lat] / 180.0 * Math::PI | |
rad_lat2 = destination[:lat] / 180.0 * Math::PI | |
a = (sin_lat * sin_lat) + (sin_lng * sin_lng) * Math.cos(rad_lat1) * Math.cos(rad_lat2) |
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
$url = "http://www.domain.com/demo.jpg"; | |
$curl = curl_init($url); | |
curl_setopt($curl, CURLOPT_NOBODY, true); | |
$result = curl_exec($curl); | |
if ($result !== false) | |
{ | |
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); | |
if ($statusCode == 404) | |
{ | |
echo "URL Not Exists" |
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
# Table Driver | |
# Id : Integer | |
# Name : String | |
# Vehicle Attributes : JSON | |
# Example: | |
# { | |
# id: 1, | |
# name: 'Driver Name', | |
# vehicle_attributes: { |
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
$('.container-fluid').find('form.mobile-price-area').parent().removeClass('col-lg-5').addClass('col-lg-12') | |
var __extends = (this && this.__extends) || (function() { | |
var a = Object.setPrototypeOf || ({ | |
__proto__: [] | |
}instanceof Array && function(e, c) { | |
e.__proto__ = c | |
} | |
) || function(f, c) { | |
for (var e in c) { | |
if (c.hasOwnProperty(e)) { |
NewerOlder