Skip to content

Instantly share code, notes, and snippets.

View knotech's full-sized avatar

Schroder knotech

  • Guadalajara, Jalisco, MX
View GitHub Profile
@konsumer
konsumer / index.js
Last active December 12, 2015 02:24
Require all the files in a directory as members of `module.exports`
/*
Generic include that loads all files as members with their own filename, good for `models/` for example
*/
var fs = require('fs')
fs.readdirSync(__dirname)
.filter(function(n){
return n[0]!=='.' && n !=='index.js' && n.substr(-3) === '.js'
})
.map(function(n){
var name = n.split('.')[0]
@Barrytron1983
Barrytron1983 / gist:48b553ddbd85e6aeae59
Created August 8, 2014 10:15
Change element based on IP location :: Wordpress/JS
/* Header */
<script>
jQuery.getJSON('http://freegeoip.net/json/', function(location) {
if (location.country_code == 'GB') {
jQuery("#change_number").text("GB Tel: +44 2307055");
}
});
</script>
@jeyraof
jeyraof / indicator.py
Last active August 29, 2015 14:04
indicator
def indicator(message='Processing...' ):
sys.stdout.write(message)
time.sleep(1)
sys.stdout.write('|')
time.sleep(1)
sys.stdout.write('\r/')
time.sleep(1)
sys.stdout.write('\r-')
time.sleep(1)
sys.stdout.write('\r\\')
@JedWatson
JedWatson / notes.md
Last active February 20, 2020 13:01
Notes on how to create a new field type for Keystone

Creating new Field Types for KeystoneJS

We're currently working on making it easier to add new field types to KeystoneJS as plugins.

In the meantime, if you'd like to work on your own field type, hopefully this guide will point you in the right direction.

Keystone fields require the following:

  • a {fieldType}.js file in ./lib/fieldTypes that controls the field and encapsulates options support, underscore functions, validation and updating
  • the {fieldType}.js file needs to be included by ./lib/fieldTypes/index.js
@grenade
grenade / sane-gnome-settings.sh
Last active February 4, 2024 08:11
my personal gnome and fedora setup preferences
# Sane settings for Gnome
gsettings set org.gnome.desktop.background show-desktop-icons true
gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing 'grayscale'
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting 'slight'
gsettings set org.gnome.desktop.interface text-scaling-factor '1.0'
gsettings set org.gnome.desktop.interface monospace-font-name "Monospace 10"
gsettings set org.gnome.desktop.interface document-font-name 'Sans 10'
gsettings set org.gnome.desktop.interface font-name 'Cantarell 10'
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita'
@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@jeyraof
jeyraof / paramdic.py
Created April 5, 2013 23:50
make http get parameter to dictionary.
__author__ = 'jaeyoung'
def make(url):
tmp = dict()
param_line = url.split("?")[1]
param_list = param_line.split("&")
for param in param_list:
par = param.split("=")
@efazati
efazati / Py Flask Skeleton
Last active December 19, 2024 07:01
Python Flask Folders and Files structure
.
├── deploy.py
├── project
│   ├── application.py
│   ├── apps
│   │   ├── articles
│   │   │   ├── forms.py
│   │   │   ├── __init__.py
│   │   │   ├── models.py
│   │   │   └── views.py
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active April 19, 2025 05:22
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@nhoffman
nhoffman / pyscript.py
Last active May 8, 2024 14:26
Python script template
#!/usr/bin/env python3
"""A simple python script template.
"""
import os
import sys
import argparse