Skip to content

Instantly share code, notes, and snippets.

View shafi-shaikat's full-sized avatar
🎯
Focusing

Shafi Shaikat shafi-shaikat

🎯
Focusing
  • Evatix
  • Dhaka, Bangladesh
View GitHub Profile
/**
* SeedGeneratorService
*
* @description :: Will generate seeds from the model specied in the development/production directory
* @help :: See http://sailsjs.org/documentation/concepts/services/creating-a-service
*/
module.exports = {
_config: {
dir: sails.config.appPath + '/seeds'
},
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Sortable - Default functionality</title>
<divnk rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
@shafi-shaikat
shafi-shaikat / application.rb
Created September 19, 2016 09:43 — forked from glaszig/application.rb
Grouped table index for ActiveAdmin
# config/application.rb
module MyApp
class Application < Rails::Application
config.autoload_paths << config.root.join('lib')
end
end
@shafi-shaikat
shafi-shaikat / fakeout.rake
Created October 5, 2016 13:51 — forked from matthutchinson/fakeout.rake
fakeout.rake - a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# NOTE: requires the faker or ffaker gem
# sudo gem install faker - http://faker.rubyforge.org
# OR
# sudo gem install ffaker - http://github.com/EmmanuelOga/ffaker
require 'faker'
class Fakeout
@shafi-shaikat
shafi-shaikat / gist:7aeb701924bf17750a60d422454b3a5f
Created May 23, 2017 11:21 — forked from neciu/gist:6bfeab3e3ae38638d8fb
Added hax enabling auto filing from existing models/properties.

Integrating TinyMCE in an ember-cli app

TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.

Step 1: Install TinyMCE:

bower install --save tinymce

Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script>
@shafi-shaikat
shafi-shaikat / sublime-text-macos-context-menu.md
Created October 2, 2017 08:20 — forked from idleberg/sublime-text-macos-context-menu.md
“Open in Sublime Text” in macOS context-menu

Open in Sublime Text

  • Open Automator
  • Create a new Service
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n $@
  • Set “Pass input” to as arguments
  • Save as Open in Sublime Text
#!/bin/bash
# Fail if any commands fail
set -e
set -o pipefail
# These are ec2 tags from which we will determine where to deploy
ec2_stage=$DEPLOY_STAGE
ec2_app="core"
ec2_role="app"
class Admin::Api::BaseController < Admin::BaseController
after_filter :set_csrf_cookie
# For client side js applications needing to qualify for Rails CSRF protection
# Normally rails will return its csrf token in the body of the request for html rendering
#
# In the case of client side apps, we return the token in a cookie
# See: https://technpol.wordpress.com/2014/04/17/rails4-angularjs-csrf-and-devise/
def set_csrf_cookie
cookies['X-CSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?