Skip to content

Instantly share code, notes, and snippets.

gmail.com
outlook.com
zoho.com
icloud.com
yandex.mail
yahoo.com
mail.com
shortmail.com
facebook.com
myway.com
@hadees
hadees / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hadees
hadees / CoffeeScript.sublime-settings
Created September 25, 2015 17:34
Sublime Settings
{
// On save last line is a eof
"ensure_newline_at_eof_on_save": true,
// On save remove trailing whitespace
"trim_trailing_white_space_on_save": true,
// Highlight current ligne, and modified tabs
"highlight_line": true,
"highlight_modified_tabs": true,
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"annotations": {
@hadees
hadees / arel_helpers.rb
Created March 5, 2016 05:41
Arel Helpers
module ArelHelpers
extend self
def self.included(base)
base.extend self
end
def asterisk(arel_table_or_model)
arel_table, columns = case arel_table_or_model
when Arel::Table
$(document).ready(function() {
if(window.self !== window.top) {
var currentHeight = document.body.clientHeight;
var resizeIframeTracker = setInterval(function() {
var height = document.body.clientHeight;
if(currentHeight !== height) {
message = JSON.stringify({"frameHeight": height})
window.parent.postMessage(message, "*");
currentHeight = height;
}
$(document).ready(function() {
if(window.self !== window.top) {
var padding = 200;
var currentHeight = window.ApplicationHelpers.pageHeight() + padding;
var resizeIframeTracker = setInterval(function() {
$(document).ready(function() {
var height = window.ApplicationHelpers.pageHeight() + padding;
if(currentHeight !== height) {
message = JSON.stringify({"frameHeight": height});
window.parent.postMessage(message, "*");
$ youtube-dl --autonumber-size 3 --restrict-filenames -o "S01E%(autonumber)s-%(title)s.%(ext)s" --playlist-reverse https://www.youtube.com/playlist?list=PLE7j5FieXSTc-2gbs7NkrDPhkS_rQS9XT
@hadees
hadees / model.rb
Created September 20, 2016 01:44
Model Template
<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
### Default Scope
### Includes and Extensions
### Constants
### Virtual attributes
class BooleanValue
# https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/column.rb#L8
FALSE_VALUES = [false, 0, "0", "f", "F", "false", "FALSE", "off", "OFF"]
def self.convert(value)
Rails.present? ? with_rails(value) : without_rails(value)
end
private