Skip to content

Instantly share code, notes, and snippets.

View normancapule's full-sized avatar

John Norman Capule normancapule

View GitHub Profile
@normancapule
normancapule / update-all.bash
Last active November 13, 2023 00:58
Bash script to update all git repos inside a parent directory
#!/bin/bash
PROJ_DIRS=(
/path/to/parent/work/directory
/path/to/another/parent/work/directory
)
update_git_repo () {
cd $1;
cd ..;
echo "---";
@normancapule
normancapule / simple-grid.scss
Created February 3, 2020 03:29
Simple Grid
@mixin set-basis($width) {
flex-basis: calc(#{$width});
max-width: calc(#{$width});
}
.simple-grid {
display: flex;
flex-wrap: wrap;
--padding: 8px;
justify-content: space-between;
@normancapule
normancapule / wat.rb
Created June 3, 2019 15:46
Playing around with method missing
module Powers
def wattr_accessor(*attrs)
wattr_reader(*attrs)
wattr_writer(*attrs)
end
def wattr_reader(*attrs)
attrs.each do |attr|
define_method "#{attr}" do
instance_variable_get(:"@#{attr}")
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
Paperclip::Attachment.default_options[:s3_host_name] = 's3.amazonaws.com'
var crypto = require('crypto'), text = 'Sourcepad123', key = 'V;S;WhgdG5lOj16ogxH8f$$P00n.qV$$JDWVkpUjqu', hash
hash = crypto.createHmac('sha1', key).update(new Buffer(text, 'utf-8')).digest('utf8')
@normancapule
normancapule / Notes
Last active October 14, 2015 11:27
How we deal with TIMEZONES!
1. User.timezone comes from momentjs moment().format("Z")
2. Everytime user logs in, we pass the browser's timezone
3. Session controller updates user timezone
'use strict'
angular.module "streams"
.controller "ClientTeamCtrl", ['$scope', '$rootScope', 'Worklog', 'Day', 'Project', 'Clients', '$pusher',
($scope, $rootScope, Worklog, Day, Project, Clients, $pusher) ->
$scope.todayDuration = {h: 0, m: 0}
$scope.weekDuration = {h: 0, m: 0, start_date: null, end_date: null}
$scope.date = moment()
$scope.week = []
$scope.worklogs = []
/*jshint unused:false */
/***************
This file allow to configure a proxy system plugged into BrowserSync
in order to redirect backend requests while still serving and watching
files from the web project
IMPORTANT: The proxy is disabled by default.
@normancapule
normancapule / gist:ddbd8afc79d2494fb75b
Created November 5, 2014 08:10
Protractor Chrome Driver error
Running "protractor:chrome" (protractor) task
Starting selenium standalone server...
Selenium standalone server started at http://10.0.4.1:47357/wd/hub
[launcher] Error: UnknownError: unknown error: Chrome version must be >= 36.0.1985.0
(Driver info: chromedriver=2.12.301324 (de8ab311bc9374d0ade71f7c167bad61848c7c48),platform=Linux 3.14.22-031422-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.49 seconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.22-031422-generic', java.version: '1.8.0_25'
// Generated on 2014-07-04 using generator-angular 0.9.2
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
var modRewrite = require('connect-modrewrite');