Skip to content

Instantly share code, notes, and snippets.

View th3hunt's full-sized avatar
🎯
Focusing

Stratos Pavlakis th3hunt

🎯
Focusing
  • Blueground
  • Athens
View GitHub Profile
@th3hunt
th3hunt / stickierHeaders.js
Created March 7, 2016 19:02
Stickier Headers - a jQuery plugin prototype
(function($) {
$.fn.stickyHeaders = function({
headerHeight= 60
} = {}) {
const $container = this; // i
const $fakeHeader = $container.find('.fake-header');
$container.on("scroll touchstart touchmove", function() {
const scrollTop = $container.scrollTop();
@th3hunt
th3hunt / onRetina.js
Last active January 28, 2016 12:38
Retina checking function
export default function onRetina() {
if (window.matchMedia) {
var mq = window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2),' +
'only screen and ( min--moz-device-pixel-ratio: 2),' +
'only screen and ( -o-min-device-pixel-ratio: 2/1),' +
'only screen and ( min-device-pixel-ratio: 2),' +
'only screen and ( min-resolution: 192dpi),' +
'only screen and ( min-resolution: 2dppx)');
return mq ? mq.matches : false
}
@th3hunt
th3hunt / xctest.swift
Last active January 11, 2016 18:06
An XCTest example
class MovieRamaInSwiftTests: XCTestCase {
let client = HttpClient.init()
let applicationManager = ApplicationManager.init()
func testExample() {
let expectation = expectationWithDescription("AlamofireGetMovies")
var searchResults : Array<MovieObj> = Array()
client.getMovieListForSearchText("She", limit: 7, currentPage: 1) { responseObject, error in
@th3hunt
th3hunt / .eslintrc
Created December 11, 2015 10:52
es6 eslint
{
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": false,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
@th3hunt
th3hunt / .gitconfig
Last active November 12, 2020 19:32
.gitconfig
[alias]
co = checkout
go = checkout -b
st = status
pr = pull --rebase
br = branch
filediff = diff --name-only
last = log -1 HEAD
fixup = commit --fixup
rebase-auto = git rebase --interactive --autosquash
@th3hunt
th3hunt / object-watch.js
Created November 7, 2015 10:09 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@th3hunt
th3hunt / .gitconfig
Created October 16, 2015 07:53
My new gitconfig
[alias]
co = checkout
go = checkout -b
st = status
pr = pull --rebase
br = branch
filediff = diff --name-only
last = log -1 HEAD
fixup = commit --fixup
@th3hunt
th3hunt / dashboard.js
Last active October 16, 2017 15:12
Chain PageObject methods with Intern.js, by having each PageObject instance using a new/enriched remote Command
define(function (require) {
var Page = require('./base/page')
, _ = require('vendor/lodash/lodash.underscore');
function DashboardPage() {
Page.apply(this, arguments);
}
DashboardPage.prototype = Object.create(Page.prototype);
@th3hunt
th3hunt / teaspoon.rb
Last active August 18, 2016 00:41
A teaspoon boot loader that works with browserify rails
# config/initializers/teaspoon.rb
module Teaspoon
module BootHelper
def create_browserify_bundle(suite)
bundle = File.join(Rails.root, 'tmp/javascripts', "suites/#{suite.name}.js")
bundle_dir = File.dirname(bundle)
FileUtils.mkdir_p(bundle_dir) unless File.directory?(bundle_dir)
specs = suite.spec_assets(false).map { |asset| "#{asset.gsub(/\.js.*$/, '')}" }
// helper to create proper asset paths if an asset host is configured
App.assets = {
assets : {
<% AssetsUtil.images.each do |img| %>
"<%= img %>" : "<%= asset_path(img) %>",
<% end %>
},