Skip to content

Instantly share code, notes, and snippets.

View oswaldoacauan's full-sized avatar
🔮
Snapshot tests are bad. Change my mind.

Oswaldo Acauan oswaldoacauan

🔮
Snapshot tests are bad. Change my mind.
View GitHub Profile
@oswaldoacauan
oswaldoacauan / gist:6187053
Created August 8, 2013 18:05
Zend - Execute a string query
<?php
$stmt = $model->getAdapter()->query(
'SELECT * FROM bugs WHERE reported_by = ? AND bug_status = ?',
array('goofy', 'FIXED')
);
$rows = $stmt->fetchAll();
@oswaldoacauan
oswaldoacauan / jquery.ajax.progress.js
Created August 27, 2013 12:17
Javascript - jQuery Ajax Progress
// Live demo
// http://jsfiddle.net/GvdSy/
$.ajax({
xhr: function () {
var xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener("progress", function (evt) {
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
}
@oswaldoacauan
oswaldoacauan / fb-most-liked.js
Created August 28, 2013 13:12
Facebook - Get most liked comment
// Copy and paste on your console (Command - Option - J (Mac) or Control -Shift -J (Windows/Linux))
// Press enter and wait the magic happens :3
var intervalShowComments = setInterval(function () {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0,
false, false, false, false, 0, null);
var cb = document.querySelector('.UFIPagerLink');
if (cb === null) {
@oswaldoacauan
oswaldoacauan / contentEditable-placeholder.css
Created August 29, 2013 23:52
CSS - Placeholder support for contentEditable elements
/ *
* Exemple:
* <div contenteditable="true" placeholder="Enter text here..."></div>
*
*/
[contenteditable=true]:empty:before {
content: attr(placeholder);
}
@oswaldoacauan
oswaldoacauan / gist:6411776
Created September 2, 2013 11:14
TagScanner renamer pattern
%albumartist%\[(%year%) ]%album%\[Disc %disc%\]%albumartist% . [%track% .] %title%
@oswaldoacauan
oswaldoacauan / gist:6412190
Created September 2, 2013 12:08
FileBot film/series pattern
// Film pattern, if you need put your folder path
// Ex: /The Matrix Collection/[1999] The Matrix/The.Matrix.1999.720p.x264
{collection}/[{y}] {n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").lowerTrail().upperInitial().replacePart(' Part $1')}/{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").lowerTrail().upperInitial().space('.')}.{y}.{vf}.{vc}
// Show pattern, if you need put your folder path
// Ex: /Seinfeld/Season 06/Seinfeld.6x01.The Chaperone.480p.RealVideo
{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").lowerTrail().upperInitial()}/{'Season '+s.pad(2)}/{n.replaceTrailingBrackets()}.{s+'x'}{e.pad(2)}.{t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")
.lowerTrail().upperInitial().replacePart(' Part $1')}.{vf}.{vc}
@oswaldoacauan
oswaldoacauan / csv-generator.php
Created September 6, 2013 12:50
PHP - CSV Generator
<?php
$csvFile = fopen('teste.csv', 'w');
fwrite($csvFile, "sep=,\r\n");
foreach($arrData as $row) {
fputcsv($csvFile, array_values($row));
}
fclose($csvFile);
@oswaldoacauan
oswaldoacauan / dot-crosshair.cfg
Created September 9, 2013 12:06
CS:GO - Dot crosshair
// Dot crosshair CS:GO
cl_crosshairalpha "255";
cl_crosshaircolor "5";
cl_crosshaircolor_b "0";
cl_crosshaircolor_r "0";
cl_crosshaircolor_g "255";
cl_crosshairdot "1";
cl_crosshairgap "-100";
cl_crosshairsize "0";
cl_crosshairstyle "2";
@oswaldoacauan
oswaldoacauan / autoexec.cfg
Last active December 22, 2015 15:49
CS:GO - autoexec
rate "128000"
hud_scaling "1"
cl_interp "0"
cl_interp_ratio "1"
cl_cmdrate "128"
cl_updaterate "128"
fps_max "0"
@oswaldoacauan
oswaldoacauan / config.cfg
Created September 9, 2013 12:21
CS:GO - config
unbindall
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"