Skip to content

Instantly share code, notes, and snippets.

View tiborsaas's full-sized avatar
🛰️
29C4D3B40280AE810FB4A81681E4417B

Tibor Szász tiborsaas

🛰️
29C4D3B40280AE810FB4A81681E4417B
View GitHub Profile
<snippet>
<!-- put this file in /packages/User/<Folder Name>/console_log.sublime-snippet then restart your Sublime Text 2 -->
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>con</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log()</description>
</snippet>
<snippet>
<!-- put this in another file /packages/User/<Folder Name>/console_dir.sublime-snippet then restart your Sublime Text 2 -->
@tiborsaas
tiborsaas / gist:9937dd83a51597a88108
Last active August 29, 2015 14:20
Dynamic Backbone models
define([
'backbone',
'models/export/YouTubeExport',
'models/export/ImgurExport'
], function (
Backbone,
YouTubeExport,
ImgurExport
) {
'use strict';
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="89.734px" height="90.8px" viewBox="0 0 89.734 90.8" enable-background="new 0 0 89.734 90.8" xml:space="preserve">
<style>
path { fill:#09f }
</style>
<path d="M89.735,4.03c0.01-1.213-0.531-2.365-1.473-3.131s-2.178-1.064-3.363-0.812L32.292,11.331
c-1.834,0.392-3.149,2.005-3.164,3.881l-0.362,47.11c-2.932-1.744-6.48-2.783-10.313-2.813l-0.17-0.002
@tiborsaas
tiborsaas / gist:9545599
Last active August 29, 2015 13:57
CSS only Lightbox
/* http://schier.co/post/creating-pure-css-lightboxes-with-the-:target-selector */
/*
<a href="#taddam">See stuff in the layer</a>
<div id="taddam" class="lightbox">
<div class="box-content"> Bla bla... </div>
<a href="#close" class="box-close">CLOSE</a>
</div>
*/
@tiborsaas
tiborsaas / gist:9415342
Last active August 29, 2015 13:57
Simple countdown function
// MM DD YYYY, HH:SS
var target_date = new Date("03-07-2014, 19:00").getTime();
var days, hours, minutes, seconds;
var countdown = document.getElementById("time");
setInterval(function () {
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
days = parseInt(seconds_left / 86400);
@tiborsaas
tiborsaas / gist:9155823
Created February 22, 2014 14:39
Search for a specific query string in a URL
var id = $('<a>').attr('href', keyword )[0].search.substr(1).split('&').map( function( el ){
var tmp = el.split('=');
if(tmp[0] == 'v'){
return tmp[1]
}
})[0];
@tiborsaas
tiborsaas / gist:7024872
Last active December 25, 2015 18:59
My Sublime Text 3 keyboard mapping
[
{ "keys": ["ctrl+."], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
{ "keys": ["ctrl+d"], "command": "duplicate_line" },
{ "keys": ["ctrl+t"], "command": "swap_line_up" },
{ "keys": ["ctrl+g"], "command": "swap_line_down" },
{ "keys": ["ctrl+e"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
]
/**
* Pacakges to install:

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@tiborsaas
tiborsaas / MediaPlayerStateWrapper.java
Last active December 14, 2015 02:28
A MediaPlayer wrapper plugin for PhoneGap.
package org.apache.cordova.plugins;
import org.apache.cordova.api.CordovaPlugin;
import org.apache.cordova.api.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.lang.reflect.Method;
@tiborsaas
tiborsaas / dabblet.css
Created February 1, 2013 12:48
CSS Based touch slider
/**
* CSS Based touch slider
*/
#slider{
width: 300px;
height: 40px;
border: 1px solid #999;
margin: auto;
margin-top: 100px;