Skip to content

Instantly share code, notes, and snippets.

View yitsushi's full-sized avatar
🏳️‍⚧️

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
#!/usr/bin/env sh
# If DEBUG environment variable is not defined set as false
if [[ "x${DEBUG}" == "x" ]]
then
DEBUG=false
fi
# Logger function. Display a message if DEBUG is true
logMessage() {
@yitsushi
yitsushi / highlight.js
Created June 26, 2013 20:07
JavaScript: (un)Highlighting Text #snippet
var TextUtil = (function() {
return {
highlight: function (text, words, tag) {
// Default tag if no tag is provided
tag = tag || 'span';
var i, len = words.length, re;
for (i = 0; i < len; i++) {
// Global regex to highlight all matches
re = new RegExp(words[i], 'g');
@yitsushi
yitsushi / isBreakPoint.js
Created June 26, 2013 20:01
JavaScript: isBreakPoint #snippet
function isBreakPoint(bp) {
// The breakpoints that you set in your css
var bps = [320, 480, 768, 1024];
var w = $(window).width();
var min, max;
for (var i = 0, l = bps.length; i < l; i++) {
if (bps[i] === bp) {
min = bps[i-1] || 0;
max = bps[i];
break;
@yitsushi
yitsushi / DOMContentLoaded.js
Created June 26, 2013 19:44
JavaScript: Run code when the document has loaded #snippet
document.addEventListener("DOMContentLoaded", DOMContentLoadedHandler, false);
function DOMContentLoadedHandler() {
// code here
}
@yitsushi
yitsushi / gist:5522839
Created May 6, 2013 01:19
ShoppingAll Home
Testing http://shopping-all.hu/
At Mon May 6 03:15:15 2013
10 loops
Fastest Median Slowest Std Dev
---------------------------------------------------------------------------
Server performance:
Total application time Unable to be recorded
Host latency:
<?php
echo ">>> Usage:\n";
function do_it($callback) {
return $callback(null, true);
}
$result = do_it(function($error, $result) {
if ($error) {
echo "Error!\n";
return false;
@yitsushi
yitsushi / product_promo_box.rb
Created February 20, 2013 15:29
Outputs a string with a given attribution as a block about a Product Promotion for Octopress
#
# Author: Balazs Nadasdi <[email protected]> (http://blog.code-infection.com/)
#
# Outputs a string with a given attribution as a block about a Product Promotion
#
# {% product_promo_box %}
# Title: Name of the product
# Author: Author (books), Manufacturer, etc
# Image: Image URL about the product
# Price: Price of the product
@yitsushi
yitsushi / simple-http-server.js
Created February 6, 2013 12:48
Simple HTTP Server with Node.js
http = require("http");
http.createServer(function(request,response){
response.writeHeader(200, {"Content-Type": "text/plain"});
response.write("Soon :)");
response.end();
}).listen(process.env.PORT || 3000);
<?php
echo "start\n";
$tomb = array(1,2,3,7,89,2,0,3,5,6,1,2);
for($i = 0; $i < 10; $i++) {
$szam = $tomb[$i];
if ($szam > 10) {
continue;
}
if ($szam < 1) {
break;
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>HTML</title>
</head>
<body>
<h1>Cim</h1>
<?php
$soseFogomHasznani = 3.14;