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 SEQUENCE $TABLE_NAME$_SEQ; | |
create or replace trigger $TABLE_NAME$_AI before insert on $TABLE_NAME$ | |
for each row begin | |
if :new.id is null then | |
SELECT $TABLE_NAME$_seq.NEXTVAL | |
INTO :new.id | |
FROM dual; | |
end if; | |
end $TABLE_NAME$_AI; |
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
DELETE FROM | |
TABLE_NAME A | |
WHERE | |
a.rowid > | |
ANY ( | |
SELECT | |
B.rowid | |
FROM | |
TABLE_NAME B | |
WHERE |
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
<html> | |
<head> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<script type="text/javascript" src="http://www.bitstorm.org/jquery/color-animation/jquery.animate-colors-min.js"></script> | |
<script> | |
$(document).ready(function() { | |
var $el = $("body > div"); | |
var colors = ["#fc0", "#d00", "#42aaff"]; | |
var dur = 3000; | |
var count = 0; |
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
alter table $TABLE_NAME$ add tmp_string varchar(10); | |
update $TABLE_NAME$ set tmp_string = cast($FIELD_NAME$ as varchar(10)); | |
alter table $TABLE_NAME$ drop column $FIELD_NAME$; | |
alter table $TABLE_NAME$ rename column tmp_string to $FIELD_NAME$; |
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
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu | |
sudo apt-get update | |
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove | |
sudo apt-get install apache2 | |
sudo a2enmod rewrite | |
service apache2 restart |
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
//using System; | |
//using System.IO; | |
var initDir = @"H:\1"; | |
var destDir = @"H:\2"; | |
var watcher = new FileSystemWatcher(initDir); | |
Func<string, string> destPath = path => path.Replace(initDir, destDir); | |
watcher.Changed += (sender, eventArgs) => File.Copy(eventArgs.FullPath, destPath(eventArgs.FullPath), overwrite: true); | |
watcher.Deleted += (sender, eventArgs) => File.Delete(destPath(eventArgs.FullPath)); | |
watcher.Renamed += (sender, eventArgs) => |
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
// ABb46un7i865bvbbr => A_B_b_4_6_u_n_7_i_8_6_5_b_v_b_b_r | |
string Process(string input) | |
{ | |
var sbCapacity = input.Length * 2 - 1; | |
var sb = new StringBuilder(sbCapacity); | |
sb.Length = sbCapacity; | |
Parallel.For(0, input.Length - 1, i => | |
{ | |
sb[i * 2] = input[i]; |
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
public static class DateExtensions | |
{ | |
public static string ToText(this DateTime date) | |
{ | |
var hour = (DateField)date.Hour; | |
bool zy = false, zm = false, zd = false; | |
if ((hour & DateField.Year) > 0) | |
zy = true; | |
if ((hour & DateField.Month) > 0) | |
zm = true; |
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
$Path = "." | |
Get-ChildItem -path $Path -recurse | | |
Where {!$_.PSIsContainer -and $_.LastWriteTime -lt (get-date).addHours(-24)} | | |
Remove-Item | |
# removing empty folders | |
Get-ChildItem -path $Path -recurse | | |
Where {$_.PSIsContainer -and @(Get-ChildItem -Lit $_.Fullname -r | | |
Where {!$_.PSIsContainer}).Length -eq 0} | |