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
| -module(fibonacci). | |
| -export([process/1]). | |
| process(1) -> | |
| [0]; | |
| process(2) -> | |
| [0,1]; | |
| process(N) -> | |
| lists:append(process(N - 1), [ lists:last(process(N - 1)) + lists:last(process(N - 2) ) ] ). |
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
| -module(numbers). | |
| -export([fib/1, triangle_numbers/1, triangle_number/1, bsearch/2, pair_sum/2]). | |
| fib(1)-> | |
| [0]; | |
| fib(2)-> | |
| [0,1]; | |
| fib(N)-> | |
| PrevFibs = fib(N-1), | |
| lists:append(PrevFibs, [ lists:nth(length(PrevFibs) - 1, PrevFibs) + lists:last(PrevFibs) ] ). |
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 | |
| function forceDownload() | |
| { | |
| $file_name = "/some/directory/not/publicly/available/" . $_GET['file']; | |
| $file = file_get_contents( $file_name ); | |
| if( !empty($file) ) | |
| { |
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
| # This class is solely used for extracting arguments from a string | |
| # It is used to process the arguments input to template_methods in the CMS content areas | |
| # It handles arguments that are comma separated, inside or outside of quotes | |
| # Like normal arguments to a programming function if something is inside a quote it will | |
| # all be part of the same argument and commas inside of quotes are part of that argument | |
| # rather than used to separate it from another argument. It also takes into account backslashes | |
| # so 'I\'m an argument' will properly be processed | |
| # | |
| # For example link("http://google.com", 'Google is fun to use, really it is') | |
| # It will result in the arguments: |
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
| require 'net/ssh' | |
| require 'optparse' | |
| options = {} | |
| OptionParser.new do |opts| | |
| opts.banner = "Usage: ruby permission.rb [-h some-host-option -a lock -u garion]" | |
| %i{host user action}.each do |option| | |
| opts.on("-#{option[0]}VALUE", "--#{option}=VALUE") do |value| |
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
| import {fetchAuthSession} from '@aws-amplify/auth'; | |
| const baseUrl = 'http://localhost:3000'; // process?.env?.REACT_APP_API_DOMAIN || ''; | |
| // makes a get request, called index because it typically is used to retrieve a collection | |
| // of models, like index of the products for a search | |
| export const index = <DataType = {}>(path: string) => { | |
| return request<DataType[]>({ | |
| url: path, | |
| method: 'GET', |
OlderNewer