Skip to content

Instantly share code, notes, and snippets.

View test3.php
<?php
function pc_permute($items, $perms = array( )) {
if (empty($items)) {
$res = $perms[0] + 13.0 * $perms[1] / $perms[2] + $perms[3] + 12.0 * $perms[4] - $perms[5] - 11.0 + $perms[6] * $perms[7] / $perms[8] - 10.0;
if ($res == 66.0) {
print join(' ', $perms) . ": $res\n";
}
} else {
for ($i = count($items) - 1; $i >= 0; --$i) {
View keymap.cson
'atom-workspace atom-text-editor:not([mini])':
'ctrl-alt-z': 'unset!'
'body':
'ctrl-alt-o': 'unset!'
'ctrl-alt-s': 'unset!'
View bidding_status.user.js
// ==UserScript==
// @name Bidding Status
// @namespace leafnode
// @include http://allegro.pl/myaccount/bid.php
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==
jQuery('#items-list tbody tr').each( function ( i ) {
View allegro_watchlist_reminders.user.js
// ==UserScript==
// @name Allegro Watchlist reminders
// @namespace leafnode
// @description Add button to enable reminders on all auctions
// @include http://allegro.pl/myaccount/watch.php
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==
View gist:33896
int wyswietl_menu( )
{
int ch;
cout << "\n 1. Wyszukiwanie ksiazek" << endl;
cout << " 2. Edycja danych" << endl;
cout << " 3. Dopisywanie danych" << endl;
cout << " 4. Wypożyczanie książek" << endl;
cout << " 5. Zwrot książek" << endl;
cout << " 6. Koniec\n\n";
cout << "Wybierz polecenie: \n? ";
View blipalacz-kontynuuj.patch
diff --git a/blipalacz.user.js b/blipalacz.user.js
index e781177..fba42b1 100644
--- a/blipalacz.user.js
+++ b/blipalacz.user.js
@@ -775,6 +775,19 @@ function Dopal() {
}
}
} else {
+
+ jQuery('span.respond').each(function(e, v){
@leafnode
leafnode / getYoutubeId.php
Created Sep 12, 2015
Get YouTube ID from URL
View getYoutubeId.php
<?php
public static function getYoutubeId($url)
{
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match))
{
return $match[1];
} else {
return false;
}
}
View gist:612960
import re
a = u'Brzozowa 4/5'
re.split('\W+',a, re.UNICODE)
# [u'Brzozowa', u'4', u'5']
a = u'Drzymały 4/5'
re.split('\W+',a, re.UNICODE)
# chce: [u'Drzymały', u'4', u'5']
# dostaję: [u'Drzyma', u'y', u'4', u'5']
@leafnode
leafnode / gist:1284186
Created Oct 13, 2011
jQuery snippet for ZendCon timetable
View gist:1284186
$jq('input.customtimetable').click( function (e) { if ($jq(this).is(':checked') ) { $jq(this).parent().css('background', '#10a010'); } else { $jq(this).parent().css('background', '#E6E7E9'); } } );
View gist:3272149
<?php
$str = "Mon Aug 06 00:00:00 BST 2012";
$d = strtotime("$str");
echo date("Y-m-d H:i", $d);
// 2012-08-06 01:00