Skip to content

Instantly share code, notes, and snippets.

@matiangul
matiangul / gist:5670745
Last active December 17, 2015 20:49
Split words in sentence into lines
base.breakAfterWhiteSpace = function() {
var $el = $(this),
text = $el.text(),
splitted = text.split(' '),
newText = splitted[0];
for(var i=1;i<splitted.length; i++) {
newText = newText + '</br>' + splitted[i];
}
console.log(newText);
$el.html(newText).addClass('splitted');
@matiangul
matiangul / gist:5671082
Created May 29, 2013 15:15
Change wordpress post date
UPDATE `admin_peoplegroup`.`wp_posts` SET
`post_date` = '2013-05-14 10:50:01',
`post_date_gmt` = '2013-05-14 10:50:01',
`post_modified` = '2013-05-14 10:50:01',
`post_modified_gmt` = '2013-05-14 10:50:01'
WHERE `wp_posts`.`ID` = 137;
@matiangul
matiangul / gist:5679140
Created May 30, 2013 16:15
delete post autosave
DELETE FROM `wp_posts` WHERE `post_name` = '188-autosave'
@matiangul
matiangul / gist:5775803
Created June 13, 2013 17:52
php function is available
<p>PHP server says that curl_exec function is <?php echo function_exists("curl_exec") == true ? 'available' : 'not available'; ?></p>
{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
@matiangul
matiangul / gpp.sublime-build
Created October 7, 2013 20:27
Sublime C++ build system for Windows Users
{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "$file_base_name & pause"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"variants":
[
{
@matiangul
matiangul / latin-1_to_utf-8
Created March 12, 2014 20:34
Mysql latin1 to utf-8 chars conversion
mysqldump -u $user -p --opt --quote-names --skip-set-charset --default-character-set=latin1 $dbname > dump.sql
mysql -u $user -p --default-character-set=utf8 $dbname < dump.sql
@matiangul
matiangul / pull_repositories
Created July 8, 2015 09:41
Pull repositories in current dir (assuming all is directory)
ls | xargs -I{} sh -c "echo {}; git -C{} pull"
<F i="I" r="00000" o="0035" d="0410">
<T t="0CI">
<FF u="991231" f="150810" s="100000" p="150812" k="07J0" fm="00001"/>
</T>
<T t="0CK">
<FF u="991231" f="150815" s="100000" p="150817" k="07J2" fm="00001"/>
</T>
...
</F>
@matiangul
matiangul / xml_read.kt
Created March 5, 2017 16:16
Read xml content using java streams in kotlin
val fileStream = Thread.currentThread().contextClassLoader.getResourceAsStream("RCS.zip")
val zipStream = ZipInputStream(fileStream).apply { nextEntry }
val xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(zipStream)