Skip to content

Instantly share code, notes, and snippets.

var abbr = 'ul>li*3>h2+p*2';
try
{
// expands abbreviation and inject results into 'my-element'
$('my-element').expandAbbreviation(abbr);
// returns an Elements object
var elements = ZenCoding.abbrToElements(abbr);
// expands abbreviation to an html string
var my_string = String.expandAbbreviation(abbr);
}
@ju1ius
ju1ius / shutdown-sudoers.sh
Created July 13, 2011 20:24
Allow all users to shutdown and reboot without password
#! /bin/bash
# Edit /etc/sudoers to allow all users to shutdown and reboot without password
# Your previous sudoers file will be backed as /etc/sudoers.bak
sudo sed -i.bak -e '$ a\
ALL ALL=\(ALL\) NOPASSWD: /sbin/shutdown, sbin/reboot
' /etc/sudoers
@ju1ius
ju1ius / gist:1106811
Created July 26, 2011 13:51
Allow all physical users to shutdown and reboot without password
#! /bin/bash
USERS=($(cat /etc/passwd | grep /home/ | grep -v /bin/false | cut -d : -f 1))
ALIAS=$(printf ",%s" "${USERS[@]}")
PATTERN="$ a\
${ALIAS:1} ALL=\(ALL\) NOPASSWD: /sbin/shutdown, /sbin/reboot
"
# Edit /etc/sudoers to allow all physical users to shutdown and reboot without password
# Your previous sudoers file will be backed as /etc/sudoers.bak
sudo sed -i.bak -e "$PATTERN" /etc/sudoers
@ju1ius
ju1ius / gist:1106957
Created July 26, 2011 15:03
Allow current user to shutdown and reboot without password
#! /bin/bash
PATTERN="$ a\
$(whoami) ALL=\(ALL\) NOPASSWD: /sbin/shutdown, /sbin/reboot
"
# Edit /etc/sudoers to allow current user to shutdown and reboot without password
# Your previous sudoers file will be backed as /etc/sudoers.bak
sed -i.bak -e "$PATTERN" /etc/sudoers
@ju1ius
ju1ius / gist:2688777
Created May 13, 2012 14:49
Xpath descendant benchmark
<?php
require 'Benchmark/Timer.php';
$timer = new Benchmark_Timer();
$nb_iterations = 1000;
/**
* BOOTSTRAP
**/
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Sonata\MediaBundle\Entity\Media"
table="media__media">
@ju1ius
ju1ius / index.js
Created January 22, 2016 10:30
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var mat4 = require('gl-mat4');
var interpolator = require('mat4-interpolator');
var inherits = require('inherits');
//
// Inlining mat4-css-parse & mat4-css-stringify here since RequireBin fails requiring them...
// nrmaliy we would just do
// var parseMatrix = require('mat4-css-parse');
@ju1ius
ju1ius / index.js
Created January 22, 2016 17:33
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var mat4 = require('gl-mat4');
var interpolator = require('mat4-interpolator');
var inherits = require('inherits');
//
// Inlining mat4-css-parse & mat4-css-stringify here since RequireBin fails requiring them...
// nrmaliy we would just do
// var parseMatrix = require('mat4-css-parse');
@ju1ius
ju1ius / batchwords.sh
Last active February 22, 2021 15:52
Testing PREG_NO_UTF8_CHECK
#!/bin/bash
if [[ ! -d "$1" ]]; then
echo "Not a directory: $1"
exit 1
fi
find "$1" -type f | while read name
do
./php-src/sapi/cli/php ./words.php "$2" < "$name" >/dev/null
@ju1ius
ju1ius / build_tf.sh
Created August 7, 2018 19:07 — forked from venik/build_tf.sh
Bash script for local building TensorFlow on Mac/Linux with all CPU optimizations (default pip package has only SSE)
#!/usr/bin/env bash
# Author: Sasha Nikiforov
# source of inspiration
# https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions
# Detect platform
if [ "$(uname)" == "Darwin" ]; then
# MacOS