Skip to content

Instantly share code, notes, and snippets.

var gulp = require('gulp');
var webserver = require('gulp-webserver');
gulp.task('webserver', function() {
gulp.src('./')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: true
}));
@yemaw
yemaw / yii_transaction.php
Created March 9, 2015 09:55
Yii (1) transaction, rollback and commit .
$transaction = Yii::app()->db->beginTransaction();
try {
if (!$model->save()) {
throw new Exception('Model cannot be saved.');
}
if (!$anothermodel->save()) {
throw new Exception('Anothermodel cannot be saved.');
}
$transaction->commit();
@yemaw
yemaw / magento dependencies installation on ubuntu
Created April 9, 2014 11:45
Installing Magento dependencies on ubuntu ec2
apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
sudo service apache2 restart
@yemaw
yemaw / logRenders.js
Created April 3, 2014 03:25
Meteor Rendered Templates Logging with Count
if (Meteor.isClient) {
//other client side codes
function logRenders () {
_.each(Template, function (template, name) {
var oldRender = template.rendered;
var counter = 0;
template.rendered = function () {
[self playVideo:@"http://www.youtube.com/v/WL2l_Q1AR_Q" frame:CGRectMake(20, 70, 280, 250)];
- (void)playVideo:(NSString *)urlString frame:(CGRect)frame
{
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
@yemaw
yemaw / Basic Game States.txt
Created April 29, 2013 04:17
Basic Game States
gameStart
gameStop
gamePlayPause
gameOver
gameFinish
@yemaw
yemaw / palindrome
Created February 14, 2013 10:09
detect palindrome text or not.
string str = string.Empty;
Console.WriteLine("Enter a String");
string s = Console.ReadLine();
int i = s.Length;
for (int j = i - 1; j >= 0; j--)
{
@yemaw
yemaw / ManualIntegerArraySorting
Created February 13, 2013 03:52
Manually Sort Integer Array
using System;
class ManualIntegerArraySorting
{
public static void Main() {
int[] arr = new int[10]{5,3,9,5,4,1,3,56,234,1};
int smallest, pointer, tmp;
for(int i=0; i<10; i++){