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
public function add() { | |
Configure::write('debug', 2); | |
try { | |
if (!$this->checkKey()) { | |
throw new Exception('Empty key', 10016); | |
} |
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
public function get_featured_deals() { | |
Configure::write('debug', 2); | |
$result = array('code' => 200, 'time' => time()); | |
try { | |
if (empty($this->request->data['private_token'])) { | |
// private token not found | |
throw new Exception('Empty private token', 10002); | |
} | |
if (empty($this->request->data['categories'])) { |
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
private function __get_id($qr_code) { | |
if (empty($qr_code)) { | |
return false; | |
} | |
$arrBarCode = explode(',', $qr_code); | |
if (empty($arrBarCode[1])) { | |
return false; | |
} | |
$beginning = substr($arrBarCode[1], 0, 16); | |
$end = substr($arrBarCode[1], -16); |
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 math | |
# stirling approximation | |
def stirling(n): | |
return math.sqrt(2*math.pi*n)*(n/math.e)**n | |
def npr(n,r): | |
return (stirling(n)/stirling(n-r) if n>20 else | |
math.factorial(n)/math.factorial(n-r)) |
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
switch ($campaign['Campaign']['deal_type']) { | |
case 'lottery': | |
$enteredLotteryCount = $this->SpecialSaving->find('count', array( | |
'recursive' => -1, | |
'conditions' => array( | |
'private_token' => $private_token, | |
'campaign_id' => $campaign['Campaign']['id'] | |
) | |
)); |
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 | |
App::uses('AppModel', 'Model'); | |
/** | |
* @property User $User | |
* @property Saving $Saving | |
* @property Scan $Scan | |
*/ | |
class Campaign extends AppModel { |
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 | |
/** | |
* Plugin Name: Batch update posts | |
* Description: Save all posts to update thumbnails | |
* Version: 1.0 | |
* Author: BK + Potion | |
* License: GPL2 | |
*/ | |
function batch_update() { |
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
public function deal_datas($private_token, $campaign_ids) { | |
$campaigns = $this->find('all', array( | |
'fields' => array( | |
'User.country_id', | |
'User.street', | |
'User.zipcode', | |
'User.location', | |
'User.phone', | |
'Campaign.id', |
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
void loadCSV() { | |
string sFileContents = ""; | |
using (StreamReader oStreamReader = new StreamReader(File.OpenRead("Test.csv"))) | |
{ | |
sFileContents = oStreamReader.ReadToEnd(); | |
} | |
List<string[]> oCsvList = new List<string[]>(); |
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
IEnumerator SpawnEnemies () | |
{ | |
yield return new WaitForSeconds (startWait); | |
while (true) | |
{ | |
for(int i = 0; i < birdCount; i++) | |
{ | |
Vector3 spawnPosition = new Vector3 (spawnLocation.x,spawnLocation.y, spawnLocation.z - 5.0f); | |
Quaternion spawnRotation = Quaternion.identity; |