Skip to content

Instantly share code, notes, and snippets.

@gabbsmo
gabbsmo / TableView navigation
Created March 15, 2012 07:23
A very simple example of TableView navigation
//create the window
var win1 = Ti.UI.createWindow(
{
backgroundColor:"#fff",
title: "Concurso"
}
);
//create navigation group
var navGroup = Titanium.UI.iPhone.createNavigationGroup(
@gabbsmo
gabbsmo / HandbrakeCLI-Hardsub.ps1
Created October 3, 2012 17:09
Hardsub mkv-files with HandbrakeCli
#COPYRIGHT: Gabriel Smoljár (2012)
#WEBSITE: http://twitter.com/gabbsmo
#DESCRIPTION: This PowerShell script process all mkv-files in a directory by
# burning the selected subtitle track into the video track.
# The video is then muxed together with the selected audio-track
# into a MP4-container.
#
#NOTES: HandbrakeCLI must be added to PATH for this script to work.
# Apply all parameters according to the HandbrakeCLI docs: https://trac.handbrake.fr/wiki/CLIGuide
#DEPENDENCIES: HanbrakeCLI, http://handbrake.fr
@gabbsmo
gabbsmo / bookmarks.php
Created January 24, 2013 18:35
wp-admin/includes/bookmarks.php r:270
<?php
/**
* @since 3.5.0
* @access private
*/
function wp_link_manager_disabled_message() {
global $pagenow;
if ( 'link-manager.php' != $pagenow && 'link-add.php' != $pagenow && 'link.php' != $pagenow )
return;
<?php
add_action( 'admin_init', 'remove_links_manager' );
function remove_links_manager(){
$role = get_role( 'author' );
$role->remove_cap( 'manage_links' );
}
var categoryMystery = new XElement("CategorySearch",
new XElement("Mystery"),
new XElement("Movies",
from m in Movies.Elements("Movie")
where m.Elements("Categories").Descendants()
.Contains(new XElement("Category", "Mystery"))
select new XElement("Movie",
new XElement("Title", m.Element("Title").Value))));
@if(Model != null) {
<table>
<thead>
<tr>
<th>Title</th>
<th>Rating</th>
<th>Year</th>
<th>Votes</th>
<th>Categories</th>
</tr>
<?php
/* User creates new account */
/* Save hashed password and salt to db */
//Username and password from $_POST
$username = 'username';
$password = 'password';
//Blowfish algorithm with a cost of 10
$algo = '$2a$10$';
//Generate a salt with no prefix and a high entropy of 23 chars
@gabbsmo
gabbsmo / mkvpropedit-dual-audio.ps1
Created April 14, 2013 22:06
This PowerShell script process sets the selected audio track (1 or 2) to default in all dual audio MKV-files in a directory
#COPYRIGHT: Gabriel Smoljar (2013)
#WEBSITE: http://twitter.com/gabbsmo
#DESCRIPTION: This PowerShell script process sets the selected audio track (1 or 2)
# to default in all dual audio MKV-files in a directory
#
#NOTES: MKVPropEdit must be added to PATH for this script to work.
#DEPENDENCIES: MKVPropEdit (included in MKVToolNix http://www.bunkus.org/videotools/mkvtoolnix/)
Param(
[parameter(Mandatory=$true)]
[alias("i")]
@gabbsmo
gabbsmo / HandbrakeCLI-Hardsub-SRT.ps1
Last active December 16, 2015 05:58
Burn in srt subtitles into a mkv-file
#COPYRIGHT: Gabriel Smoljar (2012)
#WEBSITE: http://twitter.com/gabbsmo
#DESCRIPTION: This PowerShell script process all mkv- and srt-files in a directory by
# first converting the srt subtitles to ssa and then muxing them with their
# corresponding mkv container in a tmp directory. The muxed mkv-files are then
# reencoded with the subtitles burned in.
#
#NOTES: HandbrakeCLI, FFMPEG and MKVMerge must be added to PATH for this script to work.
# Apply all parameters according to the HandbrakeCLI docs: https://trac.handbrake.fr/wiki/CLIGuide
#DEPENDENCIES: HanbrakeCLI, http://handbrake.fr; FFMPEG, http://www.ffmpeg.org;
package com.example.photodiary;
import android.content.Context;
import android.widget.ArrayAdapter;
import android.view.*;
import android.app.*;
import android.widget.*;
import java.util.*;