Navigation Menu

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 / appconfig_work.cs
Last active December 17, 2017 15:51
Working with app.config in c#
//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 January 7, 2018 14:37
Daca vreti sa le trmiteti prietenilor o urare de programator
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 February 3, 2018 08:17
code for linkedin share button
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 February 26, 2018 10:14
simple webpage that notify user with free ebook from Packtpub
<!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 March 16, 2018 12:51
My solution (or a trial) to Run Length Encoding (Function Problem)
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 April 10, 2018 18:37
Scrie o funcție în PHP 7+ care să verifice un număr natural.
<?php
/**
* Created by PhpStorm.
* User: cosmi
* Date: 09-Apr-18
* Time: 7:57 AM
*/
function CheckIfIsNumber($number = null){
@cosminpopescu14
cosminpopescu14 / AnafWS.cs
Created April 15, 2018 15:06
fetch some data with anaf web service
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 April 16, 2018 09:50
Querying Anaf WS with 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 April 16, 2018 09:51 — forked from lesstif/curl-get.php
PHP CURL POST example
<?php
class Log {
public static function debug($str) {
print "DEBUG: " . $str . "\n";
}
public static function info($str) {
print "INFO: " . $str . "\n";
}
}
<?php
function ReadCsv($file)
{
$handle = fopen($file, "r");
while(!feof($handle))
{
yield fgetcsv($handle);
}
fclose($handle);