Skip to content

Instantly share code, notes, and snippets.

View veekram's full-sized avatar
🐼
Focusing

Bikram Suwal veekram

🐼
Focusing
  • nbinfotech (p).ltd
  • Surybinayak , Bkt , Nepal
View GitHub Profile
# Curious Number
# n-digit number is said to be curious if the last n digits of
# its square are the same as the original number.
# For example, 25^2 = 625 and 76^2 = 5776.
# (Curious numbers are also known as automorphic numbers.)
# An example of 9 digit number:
# 212890625^2 = 45322418212890625
#Q. Complete the code to return all the curious numbers for n digit
@sushant12
sushant12 / curious_number.rb
Last active November 5, 2019 16:33
find curious numbers by string manipulation
class CuriousNumbers
attr_reader :digit, :largest_num
BASE_CURIOUS_NUMS = [0, 1, 5, 6].freeze
def initialize(digit)
@digit = digit.abs
@largest_num = ('9'*@digit).to_i
end
@eikes
eikes / gist:5a64b661022c756bd6522ed94770e2a6
Created July 4, 2016 14:02
List of Ruby on Rails Timezone names and their alias
["Africa/Algiers", "West Central Africa"],
["Africa/Cairo", "Cairo"],
["Africa/Casablanca", "Casablanca"],
["Africa/Harare", "Harare"],
["Africa/Johannesburg", "Pretoria"],
["Africa/Monrovia", "Monrovia"],
["Africa/Nairobi", "Nairobi"],
["America/Argentina/Buenos_Aires", "Buenos Aires"],
["America/Bogota", "Bogota"],
["America/Caracas", "Caracas"],
@adham90
adham90 / spacemacs-keybindings
Last active April 5, 2024 14:24
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
@shacker
shacker / gist:87908e13c9ee6655ce90
Last active October 5, 2023 17:46
Using the Workday API with Python and the suds client library
import sys
from suds import client
from suds.wsse import Security, UsernameToken
from suds.sax.text import Raw
from suds.sudsobject import asdict
from suds import WebFault
'''
Given a Workday Employee_ID, returns the last name of that employee.
@thebucknerlife
thebucknerlife / authentication_with_bcrypt_in_rails_4.md
Last active January 17, 2024 23:54
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@jessieay
jessieay / ActiveRecord Cheat Sheet v1
Created July 17, 2012 19:55
Active Record cheat sheet with examples of queries I've needed most so far
ActiveRecord cheat sheet / EXAMPLES
INSTALL
=======
$ gem install activerecord
in GEMFILE: gem ‘activerecord’
REQUIRE
=======
require ‘active_record’
@dideler
dideler / bootstrapping.md
Last active April 8, 2024 04:15
Bootstrapping - a list of useful resources to get up and running quickly

Welcome!

UPDATE: This list is no longer maintained. I've moved it to its own repo so you can send suggestions as Pull Requests. https://github.com/dideler/bootstrapping/

For feedback or suggestions, please send a tweet (@dideler). Gist comments don't notify me. Pull requests aren't possible with gists (yet), so I don't recommend forking because then I can't easily get the change.

Starring this gist will give me an idea of how many people consider this list useful.