Skip to content

Instantly share code, notes, and snippets.

View ismailunal's full-sized avatar
👋
Say hello!

Ismail UNAL ismailunal

👋
Say hello!
View GitHub Profile
<?
# 1
foreach (glob(resource_path() . '/lang/*/*.php') as $file) {
preg_match('#^.*/([A-z]*)/([A-z]*).php$#', $file, $matches);
$trans[$matches[1]][$matches[2]] = require($file);
}
foreach ($trans as $lang => $translations) {
$fileContents = sprintf('var trans = %s;', json_encode($translations));
file_put_contents(public_path() . '/js/trans.' . $lang . '.js', $fileContents);
if(prop("Completed") / prop("Goal") == 0, "░░░░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.1), "▓░░░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.2), "▓▓░░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.3), "▓▓▓░░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.4), "▓▓▓▓░░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.5), "▓▓▓▓▓░░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.6), "▓▓▓▓▓▓░░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.7), "▓▓▓▓▓▓▓░░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.8), "▓▓▓▓▓▓▓▓░░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.9), "▓▓▓▓▓▓▓▓▓░ ", if(smallerEq(prop("Completed") / prop("Goal"), 0.99), "▓▓▓▓▓▓▓▓▓▓ ", if(prop("Completed") / prop("Goal") == 1, " 🏁", "")))))))))))) + format(round(prop("Completed") / prop("Goal") * 100)) + "%"
@kellishouts
kellishouts / usercss-hacked-gmail.css
Last active October 20, 2023 04:42
I Hacked Gmail with an Inbox-Inspired Theme :D
/*--- #3. Hack the Tab Labels ---*/
/* Hide Ugly Tab Labels */
.aAy.aIf-aLe .aKx .aKz,
.aAy.aJi-aLe .aKx .aKz,
.aAy.aH2-aLe .aKx .aKz,
.aAy.aHE-aLe .aKx .aKz{
display: none;
}
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
mp3_byte_size = (byte_size(binary) - 128)
<< _ :: binary-size(mp3_byte_size), id3_tag :: binary >> = binary
<< "TAG",
title :: binary-size(30),
artist :: binary-size(30),
album :: binary-size(30),
year :: binary-size(4),
comment :: binary-size(30),
_rest :: binary >> = id3_tag
@PragTob
PragTob / matching.exs
Last active July 28, 2017 08:14
Elixir Pattern matching
defmodule Patterns do
def greet(%{name: name, age: age}) do
IO.puts "Hi there #{name}, what's up at #{age}?"
end
def greet(%{name: "José Valim"}) do
IO.puts "Hi José, thanks for elixir! <3"
end
def greet(%{name: name}) do
IO.puts "Hi there #{name}"
end
@alvises
alvises / app.ex
Last active March 14, 2018 09:15
GenStage and twitter stream
defmodule Twitter do
def start(_type, _args) do
import Supervisor.Spec
workers = [
worker(Twitter.Producer, ["#Rio2016"]),
worker(Twitter.Consumer, [], id: 1),
worker(Twitter.Consumer, [], id: 2),
worker(Twitter.Consumer, [], id: 3)
@yurivish
yurivish / venn-diagrams.js
Last active December 26, 2020 03:20
Area-proportional Venn Diagrams
// Since `overlapArea` function is monotonic increasing, we can perform a
// simple bisection search to find the distance that leads to an overlap
// area within epsilon of the desired overlap.
function distanceForOverlapArea(r1, r2, desiredOverlap) {
// Ensure r1 <= r2
if (r1 > r2) {
var temp = r2;
r2 = r1;
r1 = temp;
}
@mgwidmann
mgwidmann / twitter_stream.ex
Last active November 29, 2022 20:35
Infinite Streams with Elixir
# Elixir has lazily evaluated enumerable objects that allow you
# to work with enumerable objects like lists either only as needed
# or infinitely.
# Start up iex to play around
$ iex
# Typical enumeration is done eagerly where the result is computed ASAP
iex> Enum.map(1..10, fn i -> i * 2 end)
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
@bennylope
bennylope / ffmpeg-watermark.md
Created April 22, 2016 23:17 — forked from webkader/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.