Skip to content

Instantly share code, notes, and snippets.

View heitara's full-sized avatar
💻
Swift & SwiftUI

Emil Atanasov heitara

💻
Swift & SwiftUI
View GitHub Profile
#define TICK NSDate *startTime = [NSDate date]
#define TOCK NSLog(@"%s Time: %f", __PRETTY_FUNCTION__, -[startTime timeIntervalSinceNow])
//then use as follows
//TICK;
//do stuff
//TOCK;
import java.security.MessageDigest;
buildscript {
repositories {
mavenCentral()
}
}
task rename(type: Copy) {
from 'in'
<?php
// Connects to your Database
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$data = mysql_query("select * from table order by created_at desc limit 1, 2000;")
or die(mysql_error());
$row = mysql_fetch_assoc($data);
print '<table><tr>';
foreach($row as $name => $value) {
public static Picasso getImageLoader(Context ctx) {
if(sPicassoInstance == null) {
Picasso.Builder builder = new Picasso.Builder(ctx);
sTransformRequest = new Picasso.RequestTransformer() {
@Override
public Request transformRequest(Request request) {
Uri uri = request.uri;
if(uri.getScheme().startsWith("http")) {
String urlString = uri.toString();
/***
* A script which updates the bibliography numbering if there are some extra recorrd.
* For example if you have added extra [2.1] and [4.1], the script will
* go trhou it and will make [2.1] to [3] and [4.1] to [5], because [4] is already [5]
* The script will print the mapping as well.
**/
function updateBibliography() {
var bodyElement = DocumentApp.getActiveDocument().getBody();
//initial max number or reference, to generate the mapping
var max = 30;
<inputsourcedef>
<name>MY_BULGARIAN_PHONETIC</name>
<inputsourceid_prefix>com.apple.keylayout.Bulgarian-Phonetic</inputsourceid_prefix>
</inputsourcedef>
<item>
<name>Bulgarian Phonetic map 'ч' to ± </name>
<appendix>Bulgarian Phonetic map 'ч' from '`' to ±. This is valid when you get used with US layout and then switch to UK</appendix>
<identifier>private.bulgarina.phonetic</identifier>
<inputsource_only><MY_BULGARIAN_PHONETIC<name /></MY_BULGARIAN_PHONETIC></inputsource_only>
#target Illustrator
// script.name = exportLayersAsCSS_PNGs.jsx;
// script.description = mimics the Save for Web, export images as CSS Layers (images only);
// script.requirements = an open document; tested with CS5 on Windows.
// script.parent = carlos canto // 05/24/13; All rights reseved
// script.elegant = false;
/**
AT Austria
BE Belgium
BG Bulgaria
HR Croatia (Hrvatska)
CZ Czech Republic
DK Denmark
FI Finland
FR France
DE Germany
GB Great Britain (UK)
@heitara
heitara / mp3_splitter
Created July 21, 2016 08:23
MP3 Splitter using ffmpeg
#!/bin/bash
#slice mp3 file to 30 sec or less starting from the passed begginning
if [ "$#" -eq 2 ] && [ -n "$1" ]
then
DURATION=30
ffmpeg -ss $2 -i "$1" -t $DURATION -acodec copy "$1.output.mp3"
else
echo
echo