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
//core | |
//https://github.com/soomla/soomla-ios-core/blob/9c078800aa4b041bf805f432d5cbe6483adf61d7/build_all | |
xcodebuild -configuration Release ENABLE_BITCODE=YES OTHER_CFLAGS="-fembed-bitcode" -sdk iphoneos -project SoomlaiOSCore.xcodeproj -target SoomlaiOSCore clean build CREATING_UNIVERSAL_DIR=$PWD/build | |
cp -r libs/keeva/ build/ | |
//store | |
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
$(window).scroll(function () { | |
//TODO put a throttle here | |
if($(this).scrollTop() > $j('#anchor').offset().top) | |
{ | |
$element.css({ | |
position: 'fixed', | |
top: 0 | |
}) | |
} else { |
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
//in console log and memory profiler, the Child name will appear instead of Master. | |
var Child = function(){ | |
//call the parents construct, he knows what to do | |
this._construct.apply(this, arguments); | |
}; | |
Child.prototype = new Master(true);//one instance of Master will always be in memory as a prototype | |
Child.prototype.OnInit = function(params){}; |
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
SELECT p1.id,p1.cod , p2.id,p2.cod #here we find the duplicate data from cod column, but i need the ID to show ... | |
FROM `st_produse` p1 #the table, first time | |
LEFT JOIN st_produse p2 ON p1.cod = p2.cod #the table second time | |
WHERE p1.id <> p2.id #here put the key or a unique column | |
GROUP BY p1.cod #the c |
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
<!-- default value --> | |
<form method="post" enctype="application/x-www-form-urlencoded"> | |
<!-- if you want to upload a file --> | |
<form method="post" enctype="multipart/form-data"> | |
<input type="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
//usage | |
//alert (RGB_to_HEX('rgb(119,110,200)')); | |
function RGB_to_HEX(RGB) | |
{ | |
var parts = RGB | |
.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); | |
// parts now should be ["rgb(0, 70, 255", "0", "70", "255"] | |
delete (parts[0]); | |
for (var i = 1; i <= 3; ++i) { |
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 | |
/* With simplexml, open an entire file (use XMLReader for big files) | |
Example : <root><s name="abc">value</s>....</root>*/ | |
$xml = simplexml_load_file($xml_source_path); | |
//find the elemnt by attribute's value (name=..) | |
$result = $xml->xpath('//s[@name="'.$element_name.'"]'); | |
//heres the trick - the first result of xpath, and the node value (stored in [0]) | |
$result[0][0] = $new_value; | |
//here you can do a foreach, to cross over all results (all "s" elements with the same name" | |
if ($xml->asXML($xml_source_path) === false) |
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 | |
//btools.eu PHP function to cycle array values (smarty {cycle} replacement) | |
function _bCycle(&$arr) | |
{ | |
$v = next($arr); | |
if ($v === false) | |
return reset($arr); | |
return $v; | |
} | |
$table_colors = array('white','red','yellow'); |
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 | |
//just TEXT log any action, and info about it, like a purchase, use for backup/internal storage | |
//I use this for all types of requests, when dealing with online payments | |
/* LOG */ | |
file_put_contents('logs/'.date('Y.m').'.pay.log','['.$_SERVER['REMOTE_ADDR'].'] '.date('Y.m.d-H:i:s').': Order ID : '.$order_id.', Error : '.$error.', Sum'.$payed_sum.', Transaction : '.$transaction_id.PHP_EOL,FILE_APPEND); | |
//I recommend to keep the comma, for eventual csv reading | |
//automatically creates a single file per month, keeping the logs small | |
//keeps the IP and time stamp in a nice juman form |
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
/in the response page | |
header('Access-Control-Allow-Origin : *'); //* all requests origins sites are allowed |