Skip to content

Instantly share code, notes, and snippets.

View marvinahv's full-sized avatar

Marvin Herrera marvinahv

View GitHub Profile
@rijvirajib
rijvirajib / GraphQLMoment.js
Last active January 22, 2022 09:16
A GraphQL Date type using Moment as the parser allowing for any date input, formatted using moment.format()
import moment from 'moment';
import {GraphQLScalarType, GraphQLError, Kind} from 'graphql';
module.exports = new GraphQLScalarType({
name: 'Date',
/**
* Serialize date value into string
* @param {moment} value date value
* @return {String} date as string
*/
@stevenyap
stevenyap / Rake Database.md
Last active April 13, 2023 09:42
List of rake commands to manage database

Create database

rake db:create

Create database table

This will creates a migration file in /db/migrate without table definition.

rails g migration create_<TABLE>
@ingdir
ingdir / gist:0b211b9253c376f9cfa5
Last active December 3, 2023 11:47
BEM Cheatsheet

BEM Cheatsheet

BLOCK

Block encapsulates a standalone entity that is meaningful on its own.

While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Holistic entities without DOM representation (such as controllers or models) can be blocks as well.

@vparihar01
vparihar01 / nokogiri_libxml_homebrew_lion_installation.sh
Created June 25, 2013 07:01
How to fix: Nokogiri Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0. dlopen bundle.open. Using homebrew on lion to install nokogiri and lixml
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
ERROR -: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
@willurd
willurd / web-servers.md
Last active June 7, 2024 03:53
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@cobyism
cobyism / gh-pages-deploy.md
Last active June 5, 2024 21:48
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@sagar-ganatra
sagar-ganatra / WrapRenderFunction.js
Created January 25, 2013 05:52
Adding beforeRender and afterRender functions to a Backbone View Refer to the blog post http://www.sagarganatra.com/2013/01/adding-beforerender-and-afterrender-functions-to-backbone-view.html
(function () {
var TestView = Backbone.View.extend({
el: '#container',
initialize: function () {
console.log('Inside Init');
@achiurizo
achiurizo / apps.rb
Created February 1, 2012 19:15
sinatra hack to mount via padrino mount
# foo.rb
class Foo < ::Sinatra::Base
class << self
def dependencies; []; end
def setup_application!; end
end
get '/' do
'wubwub'
@WaYdotNET
WaYdotNET / controller.rb
Created June 23, 2011 13:57
how to render markdown page with haml template into Padrino ?
get :staff do
# render :markdown, :staff
render :markdown, :staff , :layout_engine => :haml, :layout => :application
end