Skip to content

Instantly share code, notes, and snippets.

(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
tmpl(document.getElementById(str).innerHTML) :
@lukaskubanek
lukaskubanek / Bundle+TestFlight.swift
Last active April 26, 2024 08:48
A code snippet for detecting the TestFlight environment for a macOS app at runtime
/// MIT License
///
/// Copyright (c) 2021 Lukas Kubanek, Structured Path GmbH
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
// myapp.js
$(function() {
var tabs=function(id) {
$(".tab").removeClass("active").filter(".tab[href*='" + id + "']").addClass("active");
$(".tabview").hide().filter("#" + id).show();
}
window.realDate=function(timestamp) {
var date = new Date(timestamp*1000);
@ludorumjeoun
ludorumjeoun / sample.html
Last active April 26, 2024 08:47
md5 utf8_encode 의존성 제거함.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="simplate.js"></script>
<script type="text/javascript">
@bjjay
bjjay / jsTemplate
Created June 20, 2012 10:23
javascript template
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
@spion
spion / u-template.js
Created October 26, 2012 11:57
JS micro-templating
module.exports = function compile(str) {
var code = "var p=[],print=function(){p.push.apply(p,arguments);};"
+ "with(obj){p.push('" + str.replace(/[\r\t\n]/g, " ")
.split("<@").join("\t")
.replace(/((^|@>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)@>/g, "',$1,'")
.split("\t").join("');")
.split("@>").join("\np.push('")
.split("\r").join("\\'") + "');}return p.join('');";
return new Function("obj", code);
@techjewel
techjewel / tmpl.js
Last active April 26, 2024 08:45
Simple JS Templating
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
// source http://ejohn.org/blog/javascript-micro-templating/
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?

How to install Homebrew package manager on Steam Deck

(See also installing Distrobox: https://distrobox.it/ )
(See also installing Nix package manager: https://determinate.systems/posts/nix-on-the-steam-deck )

You can install Homebrew (a package manager for macOS and Linux) without disabling the read-only partition with sudo steamos-readonly disable.
The package manager can be used alongside Flatpaks. Some software is only available on Flathub, and some software is only available on Homebrew.

  1. Switch to desktop mode (hold power button until a menu appears, then select "Switch to desktop mode")
  2. Click the logo at the bottom left, go to System, then go to Konsole
@jethrolarson
jethrolarson / _.template.js
Created January 19, 2012 00:56
Mod of _.template binds `this` to the element passed in, and adds <%@varname%> as a handy shortcut to <%=this.varname%>
//OVERWRITING Underscore.js's templates
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
value : /<%@([\s\S]+?)%>/g // inserts value of a variable on the object or "" if undefined
});
@donpdonp
donpdonp / uTemplate.js
Created February 24, 2015 17:58
js micro templating
var _tmplCache = {}
this.parseTemplate = function(str, data) {
/// <summary>
/// Client side template parser that uses &lt;#= #&gt; and &lt;# code #&gt; expressions.
/// and # # code blocks for template expansion.
/// NOTE: chokes on single quotes in the document in some situations
/// use &amp;rsquo; for literals in text and avoid any single quote
/// attribute delimiters.
/// </summary>
/// <param name="str" type="string">The text of the template to expand</param>