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
// 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
# 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; |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.box = 'ubuntu/trusty64' | |
config.vm.hostname = 'devbox' | |
config.vm.network "private_network", ip: "10.4.4.58" | |
config.vm.network :forwarded_port, guest: 80, host: 8080 | |
config.vm.network "forwarded_port", guest: 443, host: 44300 | |
# mysql | |
config.vm.network "forwarded_port", guest: 3306, host: 33060 |
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
cd ~ && wget http://download.redis.io/redis-stable.tar.gz | |
tar xvzf redis-stable.tar.gz | |
cd redis-stable | |
make | |
sudo cp src/redis-server /usr/local/bin/ | |
sudo cp src/redis-cli /usr/local/bin/ | |
# redis is now installed but we need to proof it | |
sudo mkdir /etc/redis | |
sudo mkdir /var/redis | |
sudo cp utils/redis_init_script /etc/init.d/redis_6379 |
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
// form validation loaded from config | |
$('.ui.form').each(function(index){ | |
var config = $(this).data('config'); | |
if(config !== undefined) { | |
$(this).prepend('<div class="ui icon error message" id="form-errors"></div>'); | |
var settings = APP.config.validation; | |
config.split('.').forEach(function(el, i, arr){ |
OlderNewer