Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
:)

Cosmin Popescu cosminpopescu14

:octocat:
:)
View GitHub Profile
View ConvertEndianess.cs
public static uint ConvertEndianess(uint data)
{
uint goodData = ((data & 0x000000FF) << 24) + ((data & 0x0000FF00) << 8) + ((data & 0x00FF0000) >> 8) + ((data & 0xFF000000) >> 24);
return goodData;
}
@cosminpopescu14
cosminpopescu14 / appconfig_work.cs
Last active Dec 17, 2017
Working with app.config in c#
View appconfig_work.cs
//first, let's instantiate the Configuration manager class
Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (ConfigurationManager.AppSettings.Count == 0)
{
configuration.AppSettings.Settings.Add("ffmpegPath", "");
configuration.Save(ConfigurationSaveMode.Full);
ConfigurationManager.RefreshSection("appSettings");
@cosminpopescu14
cosminpopescu14 / urare.cs
Created Jan 7, 2018
Daca vreti sa le trmiteti prietenilor o urare de programator
View urare.cs
var ions = from friend in FriendsList
where friend.FirstName == "insereaza numele persoanei" || friend.FirstName == "insereaza numele persoanei" ||
friend.FirstName == "insereaza numele persoanei" || friend.FirstName == "insereaza numele persoanei" || friend.FirstName == "Ionel"
select friend;
foreach(var f in friend)
{
System.Console.WriteLine("La multi ani celor care isi sarbatoresc onomastica ! :D ");
}
Console.ReadLine
@cosminpopescu14
cosminpopescu14 / linkedin_share.php
Last active Feb 3, 2018
code for linkedin share button
View linkedin_share.php
function wpb_linkedin_share_after($content) {
$sharecode .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>';
$newcontent = $content . $sharecode;
return $newcontent;
}
add_filter('the_content', 'wpb_linkedin_share_after');
@cosminpopescu14
cosminpopescu14 / packscrapper.php
Created Feb 26, 2018
simple webpage that notify user with free ebook from Packtpub
View packscrapper.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PackPub free ebook notifier</title>
</head>
<body>
<?php
require('simple_html_dom.php');
@cosminpopescu14
cosminpopescu14 / RunLengthEncoding.cs
Created Mar 16, 2018
My solution (or a trial) to Run Length Encoding (Function Problem)
View RunLengthEncoding.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication11
{
//https://practice.geeksforgeeks.org/problems/run-length-encoding/1#ExpectOP
@cosminpopescu14
cosminpopescu14 / CheckIfIsNumber.php
Last active Apr 10, 2018
Scrie o funcție în PHP 7+ care să verifice un număr natural.
View CheckIfIsNumber.php
<?php
/**
* Created by PhpStorm.
* User: cosmi
* Date: 09-Apr-18
* Time: 7:57 AM
*/
function CheckIfIsNumber($number = null){
@cosminpopescu14
cosminpopescu14 / AnafWS.cs
Created Apr 15, 2018
fetch some data with anaf web service
View AnafWS.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
namespace ConsoleApp9
{
class Program
@cosminpopescu14
cosminpopescu14 / AnafWSQuery.php
Created Apr 16, 2018
Querying Anaf WS with php
View AnafWSQuery.php
<?php
$anafEndpoint = "https://webservicesp.anaf.ro/PlatitorTvaRest/api/v3/ws/tva";
$data = '[{"cui":"", "data":"2018-04-16"}]';
$curl_option = [
CURLOPT_URL => $anafEndpoint,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array('Content-Type: application/json'),
@cosminpopescu14
cosminpopescu14 / curl-post.php
Created Apr 16, 2018 — forked from lesstif/curl-get.php
PHP CURL POST example
View curl-post.php
<?php
class Log {
public static function debug($str) {
print "DEBUG: " . $str . "\n";
}
public static function info($str) {
print "INFO: " . $str . "\n";
}
}
You can’t perform that action at this time.