Skip to content

Instantly share code, notes, and snippets.

View cosminpopescu14's full-sized avatar
🎯
Focusing

Cosmin Popescu cosminpopescu14

🎯
Focusing
View GitHub Profile
@cosminpopescu14
cosminpopescu14 / server.go
Created October 14, 2018 11:18
Simple go http server
package main
import (
"io"
"net/http"
)
const port = ":8000"
func main() {
@cosminpopescu14
cosminpopescu14 / returns.go
Created October 14, 2018 11:18
Ways of returning
package main
import "fmt"
func main() {
var all InfoParameters
all.A = 1
all.B = "good"
all.C = true
all.D = 2
@cosminpopescu14
cosminpopescu14 / SampleBlazorComponent.cshtml
Created October 18, 2018 05:01
Just a simple blazor page
@page "/big_json"
@inject HttpClient Http
@if (friends == null)
{
<p><em>Loading...</em></p>
}
else
{
@cosminpopescu14
cosminpopescu14 / Random_Rows.sql
Created October 20, 2018 08:19
Pick random rows
/****** Script for slect random rwos. Works better with a large table and a good designed database ;) ******/
declare @rand bigint
declare @maxid int = (select max(id) from dbo.TODOS);
select @rand = abs((CHECKSUM(newid()))) % @maxid;
select *
from TODOS as t
where t.id >= @rand
@cosminpopescu14
cosminpopescu14 / NonAscii.java
Created October 23, 2018 05:19
Non ascii in java
int ⁀‿⁀ = 0, ⁀⁔⁀ = 1, ¢ = 2;
String nonAscii = "⁀‿⁀";
if (⁀‿⁀ != ⁀⁔⁀)
System.out.println(¢);
System.out.println(nonAscii);
a = "<del>Ca </del><del>arhitect </del><del>nu </del><del>te </del><del>angajeaza </del><del>nimeni </del><del>decat </del><del>cu </del><del>titlu</del><del>.</del> <del>Am </del><del>incercat </del><del>si </del><del>majoritatea </del><del>ofereau </del><del>3500 </del><del>net </del>(<del>eu </del><del>ceream </del><del>pe </del><del>la </del><del>4000</del><del>)</del><del>.</del> <del>Cred </del><del>ca </del><del>in </del><del>Romania </del><del>pozitia </del>de <del>arhitect </del><del>nu </del><del>e </del><del>inteleasa </del><del>prea </del><del>bine</del><del>.</del>".replace("<del>", " ").replace("</del>", " ")
print (a)
var x = 10;
System.out.println(x);
@cosminpopescu14
cosminpopescu14 / top_romanian_users_on_so.sql
Last active February 3, 2019 08:38
Top romanian users onm Stackoverflow
select top 20 Reputation, DisplayName, WebsiteUrl, Location, RANK()
over (order by Reputation desc) as Ranking
from Users
where Location like '%Romania%'
order by Reputation desc
select Reputation, DisplayName, WebsiteUrl, Location, RANK()
over (order by Reputation desc) as Ranking
@cosminpopescu14
cosminpopescu14 / rsync.sh
Created December 6, 2018 06:26
Sync 2 folder with rsync
rsync -avz . --dry-run --exclude='.idea,vs,cache*' ../../../../xampp/htdocs/2PerformantIntegration
@cosminpopescu14
cosminpopescu14 / .htaccess
Created December 9, 2018 16:01 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/