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 | |
// app/start/global.php | |
$start = microtime(true); | |
App::finish(function() use ($start) { | |
echo "<script>console.log('App finish: ".round((microtime(true)-$start)*1000,3)." ms')</script>"; | |
}); |
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 | |
function addAttributeOption($attribute_code, $attribute_value) { | |
$attribute_model = Mage::getModel('eav/entity_attribute'); | |
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ; | |
$attribute_code = $attribute_model->getIdByCode('catalog_product', $attribute_code); | |
$attribute = $attribute_model->load($attribute_code); | |
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
// paths | |
var combine_dir = 'resources/assets'; | |
var build_dir = 'resources/assets/build'; | |
var less_file = 'main'; | |
var less_output = combine_dir + '/css'; | |
// set scripts to combine | |
var scripts = [ | |
'vendor/jquery/jquery.js', | |
'js/main.js' |
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
// new label node | |
let lbl = SKLabelNode() | |
// set label props | |
lbl.text = "POLYGON"; | |
lbl.fontSize = 20; | |
// set label position | |
lbl.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMaxY(self.frame)-30); | |
// add to frame |
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
// create image sprite | |
let img = SKSpriteNode(imageNamed:"ImageName"); | |
// scale the image | |
img.xScale = 0.5; | |
img.yScale = 0.5; | |
// set the image position | |
img.position = CGPoint(x: 100, y: 100); |
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
func didReceiveCredit(creditInfo: [NSObject:AnyObject]!) { | |
// the following does not work | |
var amount: Int = creditInfo["credits"]! as Int | |
// nor does this | |
var amount: Int = Int(creditInfo["credits"]! as NSNumber) | |
// but this does | |
var amount: String = creditInfo["credits"]! as String |
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 | |
// creating new event handlers by extending Handler and | |
// store them in a "Handlers" directory to be read by | |
// the service provider, which will loop through the | |
// directory and Event::subscribe to each one. | |
// Make sure you prefix each handler method with | |
// "on" (ex: onUserRegister) as only these methods | |
// will be listened for. |
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
var fs = require('fs'); | |
var path = require('path'); | |
var gulp = require('gulp'); | |
var plugins = require('gulp-load-plugins')(); // Load all gulp plugins | |
// automatically and attach | |
// them to the `plugins` object | |
var runSequence = require('run-sequence'); // Temporary solution until gulp 4 | |
// https://github.com/gulpjs/gulp/issues/355 |
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
# command line: | |
sudo -u postgres createuser --superuser username | |
sudo -u postgres createdb -O vagrant dbname | |
# enter shell | |
psql dbname username | |
# list users: | |
\du | |
#list databases: | |
\list |
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
# create app file | |
sudo vim /etc/nginx/sites-available/appname | |
# insert server block in app file | |
server { | |
listen 80 default_server; | |
server_name www.mydomain.com; | |
passenger_enabled on; | |
passenger_app_env development; | |
root /vagrant/appname/public; |
OlderNewer