Skip to content

Instantly share code, notes, and snippets.

View charlesponti's full-sized avatar

Charles Ponti charlesponti

View GitHub Profile
@charlesponti
charlesponti / bowerize.rb
Created August 17, 2014 22:32
Create Bower Package
puts '===================='
puts '======BOWERIZE======'
puts '===================='
puts '1. What\'s the name of your super awesome Bower package?'
@package_name = gets.chomp
puts '2. What is your GitHub username?'
@github_username = gets.chomp
@charlesponti
charlesponti / google_card.css
Created October 2, 2014 17:16
Google Card CSS
.card {
padding:1.5rem;
box-shadow:0 1px 2px #aaa;
background:white;
margin:0 1rem 1rem;
border-radius:3px;
user-select:none;
animation:fly-in-from-left .5s 1s ease both;
transform-origin:top left;
}
function Json2CSV(objArray)
{
var
getKeys = function(obj){
var keys = [];
for(var key in obj){
keys.push(key);
}
return keys.join();
}, objArray = format_json(objArray)
@charlesponti
charlesponti / config-loader.js
Last active August 29, 2015 14:07
Load a JSON config file based on NodeJS environment
var fs = require('fs');
var path = require('path');
var env = process.env.NODE_ENV;
var configFile = path.resolve(__dirname, './environments/'+env+'.json');
var config = JSON.parse(fs.readFileSync(configFile));
Object.keys(config).forEach(function(key) {
process.env[key] = config[key];
});
@charlesponti
charlesponti / responsive-breakpoints.less
Last active August 29, 2015 14:08
Responsive Breakpoints
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@charlesponti
charlesponti / htmlelement_polyfill.js
Created November 9, 2014 15:15
HTMLElement#empty polyfill
HTMLElement.prototype.empty = function() {
Array.prototype.slice.call(this.children).forEach(function(child) {
this.removeChild(child);
}.bind(this))
}
@charlesponti
charlesponti / new-tabpanel.jsx
Last active August 29, 2015 14:09
ReactJS TabPanel
// Usage
var React = require('react');
var TabPanel = require('./TabPanel.jsx');
var MyTabPanel = React.createClass({
mixins: [TabPanel],
getDefaultProps: function() {
return {
@charlesponti
charlesponti / country_codes.js
Created November 27, 2014 00:43
Telephone country codes
module.exports = [
{
country: 'United States of America (+1)',
"code": "1"
}, {
country: 'Canada (+1)',
"code": "1"
}, {
country: 'Russia (+7)',
"code": "7"
@charlesponti
charlesponti / gist:69798093b31606ad1c2c
Created December 25, 2014 10:34
Get JavaScript function argument names
var x = function(x, y) {
/** code */
};
x.toString()
.replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s))/mg,'')
.match(/^function\s*[^\(]*\(\s*([^\)]*)\)/m)[1]
.split(/,/)
@charlesponti
charlesponti / ui-view-nganimate
Created January 10, 2015 22:45
AngularUI + ngAnimate ui-view animation
/* Have to set height explicity on ui-view
to prevent collapsing during animation*/
[ui-view] {
padding-top: 55px;
height: 100%;
}
.ui-view-container {
position: relative;
}