This file contains 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 MyModel { | |
/** | |
* @return array validation rules for model attributes. | |
*/ | |
public function rules() | |
{ | |
return array( | |
array( | |
'element', |
This file contains 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
a = document.getElementsByTagName('input'); | |
for (i=0;i<a.length;i++) { | |
if (a[i].type == 'checkbox') { | |
a[i].checked = true; | |
} | |
} |
This file contains 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
o = document.getElementsByClassName('data')[0]; | |
str = ""; | |
for (i = 1; i < o.rows.length - 1; i++) { | |
str += o.rows[i].cells[1].getElementsByTagName('a')[0].innerHTML | |
+ ": " + o.rows[i].cells[8].innerHTML | |
+ "\n"; | |
} | |
alert(str); |
This file contains 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 | |
if (class_exists('Memcache')) { | |
$server = 'localhost'; | |
if (!empty($_REQUEST['server'])) { | |
$server = $_REQUEST['server']; | |
} | |
$memcache = new Memcache; | |
$isMemcacheAvailable = @$memcache->connect($server); | |
if ($isMemcacheAvailable) { |
This file contains 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 | |
if (!empty($_GET['redir']) && $_GET['redir'] < 11) { | |
sleep(1); | |
$url = '?redir=' . ($_GET['redir'] + 1); | |
header("Location: {$url}"); | |
exit; | |
} | |
?><!DOCTYPE html> | |
<html> | |
<head> |
This file contains 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 | |
/** | |
* Get upcomming match schedule | |
*/ | |
function getNextMatches($referenceTime = null) | |
{ | |
$matchSchedule = array( | |
"2014-06-13 01:30:00" => array('team1' => 'BRA', 'team2' => 'CRO', 'date' => '2014-06-13 01:30:00', 'team1Class' => 'brazil', 'team2Class' => 'croatia'), | |
"2014-06-13 21:30:00" => array('team1' => 'MEX', 'team2' => 'CMR', 'date' => '2014-06-13 21:30:00', 'team1Class' => 'mexico', 'team2Class' => 'cameroon'), |
This file contains 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 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
function bjMigrateMac() | |
{ | |
# http://lowendmac.com/2009/step-by-step-guide-to-manual-mac-system-migration/#nowork | |
host="$1" | |
if [ ! "${host}" ]; then | |
host="mac13" | |
fi | |
declare -a aHomeFilesToSync=( |
This file contains 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 for Jira's REST API for issues | |
var getIssueURL = "https://[Your Jira host]/rest/api/2/issue/"; | |
// Personally I prefer the script to handle request failures, hence muteHTTPExceptions = true | |
var fetchArgs = { | |
contentType: "application/json", | |
headers: {"Authorization":"Basic [Your BASE64 Encoded user:pass]"}, | |
muteHttpExceptions : true | |
}; |
This file contains 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
#!/bin/bash | |
userDir=bijay | |
githubUser=bijayrungta | |
homeDir=/home/${userDir} | |
mkdir -p ${homeDir}/.ssh | |
if [ f ${homeDir}/.ssh/authorized_keys ]; then | |
echo "User ${userDir} exists with an 'authorized_keys' file" | |
else | |
wget https://github.com/${githubUser}.keys -O /tmp/${githubUser}.keys; |
OlderNewer