Skip to content

Instantly share code, notes, and snippets.

@sorich87
sorich87 / currency.ts
Created February 9, 2024 10:55
Currency conversion with Currency API
const COUNTRY_CURRENCY: { [key: string]: string } = {
BJ: "XOF",
BF: "XOF",
CD: "CDF",
CI: "XOF",
CG: "XAF",
CM: "XAF",
GA: "XAF",
GH: "GHS",
GN: "GNF",
@sorich87
sorich87 / LICENSE.md
Created October 20, 2023 12:02
Implementation du widget de Nokash dans une app utilisant React pour le frontend
// NOT TESTED. Use with `<div my-controller="exampleCtrl" locals="{some: someVal, another: anotherVal}">`
angular.module('exampleApp', [])
.directive('myController', ['$controller', '$q', function ($controller, $q) {
return {
scope: true,
priority: 500,
link: function (scope, elem, attrs) {
var locals = scope.$eval(attrs.locals);
var promises = {};
@sorich87
sorich87 / style.css
Created October 18, 2012 05:35
Modified Twenty Eleven css file
/* =Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html
-------------------------------------------------------------- */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
@sorich87
sorich87 / gist:2392858
Created April 15, 2012 13:42
Send WordPress emails via SMTP
function my_phpmailer_init( $phpmailer ) {
if ( ! defined( 'SMTP_HOST' ) )
return;
$phpmailer->IsSMTP();
$phpmailer->Host = SMTP_HOST;
$phpmailer->Port = defined( 'SMTP_PORT' ) ? SMTP_PORT : 25;
if ( defined( 'SMTP_USER' ) ) {
$phpmailer->SMTPAuth = true;
$phpmailer->Username = SMTP_USER;
<?php
/**
* Get a field by its id or slug
**/
public static function get_by( $field, $value ) {
global $wpdb;
switch ( $field ) {
case 'id' :
@sorich87
sorich87 / .gitignore
Created December 13, 2011 17:06 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@sorich87
sorich87 / about.md
Created August 10, 2011 14:53 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
<?php
function file_it($url) {
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $url);
$contents = curl_exec($c);
curl_close($c);
$file = basename($url);
@sorich87
sorich87 / gist:813342
Created February 6, 2011 12:35
WordPress Download and Extraction
function file_it($url) {
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $url);
$contents = curl_exec($c);
curl_close($c);
$file = basename($url);
if ($contents) file_put_contents($file, $contents);