Welcome To Snipplr
Everyone's Recent Snippets Tagged function
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Calculates the center moving average for a time period. The vA requires a range or an array of numbers and the iSteps takes the number of periods in the timeframe (4 for quarters, 7 for weekly, ect)
1
4289
posted 11 years ago by BDOGG32
Uses regular expressions to do string manipulation. Enter a regular expression into the required parameter and what you want the manipulation to do and it will process the string manipulation. For example if A1 contains John Doe1, Jane Doe2, John W...
2
4044
posted 11 years ago by BDOGG32
This snippet allows to know the parent function caller name of any level from the calling function.
1
2544
posted 11 years ago by zandor
use anonymous function that returns parameter passed to it to evaluate functions, constants, and expressions in HEREDOC
0
2998
posted 11 years ago by Queue
For example, in a button, in OnClientClick method, pass parameters for a javascript method.
0
4949
posted 12 years ago by keidash
Find a key from a list of values​​.
parameters:
sbValues​​: List of Values 'A;B;C;D'
sbToken: Key 'B'
sbSeparator: ',' or any defined sbValues
Example:
select FSBFINDTOKEN('A;B;C;D','B',';')
from DUAL;
-------------------
Y
0
3752
posted 12 years ago by ceduard0
If you know a libref or fileref, the PATHNAME function can be used to return the physical location.
If the libref refers to more than one physical location, all of those locations will be returned, in quotes, separated by spaces, with the whole li...
0
3927
posted 12 years ago by webonomic
Checks if two given arrays equal each other as php doesn't have a built in function for this.
0
2474
posted 13 years ago by MaxHudson
To set cookie use "cookie('name of your cookie','cookie data','expire date ')" it will set your cookie in the user browser .
To get the saved cookie use "cookie('name of your cookie')" it will give you the value of the cookie which you saved in the...
0
2490
posted 13 years ago by kameshsoft
JavaScript
Template for a Javascript function with optional and mandatory arguments passed as an object collection
A simple template for a JavaScript function which allows for an arbitrary number of named arguments to be passed in. This is achieved by passing a single object as an argument with each of the 'real' arguments being a key/value pair. In this way argu...
0
3394
posted 13 years ago by davidwaterston
This is a method that can be used to take a connection string and a valid oledb command and perform a scalar. This returns an Integer/Int32 value.
0
3683
posted 13 years ago by nimblebits
This function dosen't use curl, or any other libraries. Just include it in your function library and use it like this:
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson¶ms=select * from user");
0
3122
posted 13 years ago by halk
Set the desired date within the function.
Make some images and label them "1.jpg, 2.jpg, 3.jpg, etc...".
That's how it's done.
1
2694
posted 13 years ago by o0110o
This function will force a file to be downloaded. It accepts $_path as a parameter.
1
2864
posted 13 years ago by o0110o
This function performs several checks to make sure it's getting the correct IP address.
1
3235
posted 13 years ago by o0110o
A handy function to get the contents of a file with curl. Accepts $_path as a parameter.
1
3092
posted 13 years ago by o0110o
This function will use curl to see if a file exists at the location it's provided. It accepts $_path as a parameter.
1
3389
posted 13 years ago by o0110o
A function to get a files size via curl. Accepts $_path, $_unit, $_float, $_username & $_password; In the listed order.
1
3363
posted 13 years ago by o0110o
This is a function to retrieve the mime-type of a file by checking the header response with curl. It accepts the file-path as a parameter & it also has a fallback for empty returns.
1
3895
posted 13 years ago by o0110o
Use: echo format_size(filesize("fichier"));
Example result: 13,37 Ko
0
2499
posted 13 years ago by zhyar
I wanted to make a function / method and pass a var to it form another class.
0
4045
posted 13 years ago by kutyadog
Convert 12-hour time format with hour, minutes, seconds, and meridiem into 24-hour format. Performs data correction to make sure hours, minutes and seconds have leading zeros if needed.
The trick here is to use strtotime() where we pass the time...
0
6315
posted 13 years ago by kosinix
Simulate the $_GET array from php in javascript to get url parameters this way:
url= http://localhost/?var1=example
$_GET['var1'] will return "example"
Just copy and paste the code.
2
3112
posted 13 years ago by sergiazow
Function to prevent sql injection in Like queries, where the characters '_' and '%' can be dangerous.
0
3043
posted 13 years ago by TimoZachi
Clear all text fields on focus based on original value with single function. The code checks for a 'title' attribute on each input with class 'text' and compares this to the current value of the field.
0
2929
posted 14 years ago by Huskie
In this purely constructed example, we create anonymous function and use call to invoke it on every object in an array. The main purpose of the anonymous function here is to add a print function to every object, which is able to print the right index...
0
2799
posted 14 years ago by hellowouter