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
-- SPLIT_STR MySQL Function | |
-- from http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/ | |
CREATE FUNCTION SPLIT_STR( | |
x VARCHAR(255), | |
delim VARCHAR(12), | |
pos INT | |
) | |
RETURNS VARCHAR(255) | |
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos), |
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
SELECT id, | |
@rnk:=IF(@preval <=> score, @rnk, @row + 1) AS dns_rnk, | |
@row:= @row+1 AS rnk, | |
@preval:=score as score | |
FROM table | |
# be careful for NULL handling. | |
# if all the values of score column are null, then dns_rank will zero. | |
# please set proper initial value for @preval based on your data. | |
JOIN (SELECT @rnk := 0, @preval :=null, @row := 0) r | |
ORDER BY score DESC |
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
SELECT cm_id, | |
@rnk:=IF(@preval <=> column, @rnk, @rnk + 1) AS rank, | |
@preval:=social_profile_score_absolute AS social_profile_score_absolute | |
FROM table | |
JOIN (SELECT @rnk := 1, @preval :=0) r | |
ORDER BY social_profile_score_absolute ASC |
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
SELECT datname,procpid,current_query FROM pg_stat_activity |
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
SELECT pg_cancel_backend(pid of the process) |
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
for f in *.php4; do mv $f `basename $f .php4`.php; done;Add (append) an extension to all files |
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
for f in *; do mv $f `basename $f `.txt; done; |
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
for f in *.txt; do mv $f `basename $f .txt`; done; |
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 myApp = angular.module('myApp', []); | |
myApp.directive('clock', function($timeout, dateFilter){ | |
return function(scope, element, attrs){ | |
var timeoutId; // timeoutId, so that we can cancel the time updates | |
// schedule update in one second | |
function updateLater() { | |
// save the timeoutId for canceling | |
timeoutId = $timeout(function() { |
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
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) { | |
$scope.$on('authLoaded', function() { | |
$scope.isExpert($scope.main.serieId); | |
$scope.isMember($scope.main.serieId); | |
}); | |
$scope.loadAuth = function() { | |
Auth.load().success(function(data) { | |
$scope.main.user = data.user; | |
$scope.$broadcast("authLoaded"); |
OlderNewer