Skip to content

Instantly share code, notes, and snippets.

🐜
noob

Agung Yuliaji agungyuliaji

🐜
noob
Block or report user

Report or block agungyuliaji

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View exam.md

Activities

  • coding frontend + test
  • problem solving
  • showcase logic, features, styles, etc
  • ngopi

Endpoints:

List

View sample-calc.rb
Aptitude::Calculation.new({:R=>[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5], :I=>[2, 4, 4, 2, 2, 1, 1, 3, 1, 1, 3, 3, 2, 2, 3], :A=>[4, 2, 2, 1, 4, 2, 2, 2, 2, 1, 1, 3, 4, 2, 2, 4, 1, 4], :S=>[3, 2, 3, 3, 3, 1, 1, 4, 4, 2, 2, 3, 2, 1, 4, 4, 1, 1], :E=>[3, 4, 4, 2, 3, 4, 1, 4, 1, 3, 4, 3, 4, 4, 4, 3, 4], :C=>[3, 3, 2, 4, 1, 2, 3, 1, 1, 1, 3, 4, 4, 1, 4, 4], :EI=>[1, 1, 3, 2, 4, 3, 4, 1, 2, 1], :SN=>[3, 2, 2, 2, 2, 4, 2, 4], :TF=>[1, 4, 2, 2, 2, 2, 4, 4, 3, 1, 2], :KE=>[1, 3, 1, 3, 1, 2, 4, 3, 3, 1]})
View routes_with_constraints.rake
namespace :routes do
desc 'Print out all defined routes in match order, with names, per constraint class. Target specific constraint class with CONSTRAINT=x. Target specific controller with CONTROLLER=x.'
task constrained: :environment do
Rails.application.reload_routes!
constraints_routes = Hash.new
Rails.application.routes.routes.each do |route|
group = (route.app.class == ActionDispatch::Routing::Mapper::Constraints ? route.app.send( :constraints ).first.to_s : 'No constraint class')
constraints_routes[group] ||= []
View gist:eb5281dc891457bb2f74a5080596a26c
server {
listen 5500;
server_name localhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://localhost:5000;
}
View gist:f64a95a2ab63c6cf7564cc977f6fed69
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout localsite.key \
-new \
-out localsite.crt \
-subj /CN=\*.localsite.dev \
-reqexts SAN \
-extensions SAN \
View streamjson.sjson
{"Lorem": "ipsum2"}
{"dolor": "sit"}
{"amet": "consectetur"}
{"adipiscing": "elit"}
{"Sed": "mattis"}
{"justo": "at"}
{"purus": "pulvinar"}
{"varius": "Nullam"}
{"eget": "magna"}
{"eget": "lorem"}
View controller_example.js
var schedulesControllers = angular.module('schedulesControllers', []);
schedulesControllers.controller('weekControllers', function($scope, $ionicHistory, $ionicLoading, schedulesService, $ionicSlideBoxDelegate, $interval, $filter, $state) {
$ionicLoading.show({
content: 'Loading',
animation: 'fade-in',
showBackdrop: true,
maxWidth: 200,
showDelay: 0
});
View ntfs-3g-install
brew install ntfs-3g
sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig
sudo ln -s /usr/local/Cellar/ntfs-3g/2014.2.15/sbin/mount_ntfs /sbin/mount_ntfs
The new osxfuse file system bundle needs to be installed by the root user:
sudo /bin/cp -RfX /usr/local/opt/osxfuse/Library/Filesystems/osxfusefs.fs /Library/Filesystems/
sudo chmod +s /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs
View SEO-optimizing-CarrierWave-URLs.rb
class ProductImageUploader < CarrierWave::Uploader::Base
def store_dir
"product"
end
def filename
ext = File.extname(original_filename) if original_filename
"#{model.name.parameterize}#{ext}"
end
@agungyuliaji
agungyuliaji / include_jquery_from_console.js
Created May 5, 2014
Include jQuery in the JavaScript Console
View include_jquery_from_console.js
var jq = document.createElement('script');
jq.src = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
You can’t perform that action at this time.